Created
November 14, 2017 18:05
-
-
Save brunofrank/049a6c0ed79e2c2209eb40939136e034 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setupOneSignal(){ | |
this.oneSignal.startInit('ab4692d4...'); | |
this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification); | |
this.oneSignal.handleNotificationReceived().subscribe((jsonData) => { | |
if (jsonData.isAppInFocus){ | |
let alert = this.alertCtrl.create({ | |
title: notification.title, | |
message: notification.body, | |
buttons: ['OK'] | |
}); | |
alert.present(); | |
} | |
}); | |
this.oneSignal.iOSSettings({kOSSettingsKeyAutoPrompt: false, kOSSettingsKeyInAppLaunchURL: false}); | |
this.oneSignal.endInit(); | |
this.oneSignal.getIds().then((deviceID) => { | |
let _vendor = this.platform.is('android') ? 'android' : 'ios'; | |
let deviceData = {player_id: deviceID.userId, token: deviceID.pushToken, vendor: _vendor} | |
this.sessionProvider.saveDeviceData(deviceData); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment