Gets the last known push token. Batch MUST be started in order to use this method.
The returned token might be outdated and invalid if this method is called too early in your application lifecycle.
On iOS, your application should still register for remote notifications once per launch, in order to keep this value valid.
The last known push token (can be null or empty), wrapped in a promise.
Call this method to trigger the iOS popup that asks the user if they want to allow notifications to be displayed, then get a Push token. The default registration is made with Badge, Sound and Alert. You should call this at a strategic moment, like at the end of your onboarding.
Batch will automatically ask for a push token if the user replies positively.
You should then call refreshToken
on every application start.
Call this method to ask iOS for a provisional notification authorization.
Batch will then automatically ask for a push token.
You should then call refreshToken
on every application start.
Provisional authorization will NOT show a popup asking for user authorization, but notifications will NOT be displayed on the lock screen, or as a banner when the phone is unlocked. They will directly be sent to the notification center, accessible when the user swipes up on the lockscreen, or down from the statusbar when unlocked.
This method does nothing on iOS 11 or lower.
Change the used remote notification types on Android. (Ex: sound, vibrate, alert) Example : setAndroidNotificationTypes(batch.push.AndroidNotificationTypes.ALERT | batch.push.AndroidNotificationTypes.SOUND)
Any combined value of the AndroidNotificationTypes enum.
Change the used remote notification types on iOS. (Ex: sound, vibrate, alert) Example : setiOSNotificationTypes(batch.push.iOSNotificationTypes.ALERT | batch.push.iOSNotificationTypes.SOUND)
Any combined value of the AndroidNotificationTypes enum.
Set whether notifications should be show in the foreground on iOS.
If true, notifications will be shown like if the user was outside of your application and
batchPushReceived
will only be triggered when the notification is tapped.
Clear the app badge on iOS. No effect on Android.