Implements

  • PushModule

Constructors

Properties

AndroidNotificationTypes: typeof AndroidNotificationTypes
iOSNotificationTypes: typeof iOSNotificationTypes

Methods

  • Clear the app badge on iOS. No effect on Android.

    Returns void

  • Dismiss the app's shown notifications on iOS. Should be called on startup. No effect on Android.

    Returns void

  • 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.

    Returns Promise<undefined | string>

    The last known push token (can be null or empty), wrapped in a promise.

  • Ask iOS to refresh the push token. If the app didn't prompt the user for consent yet, this will not be done. You should call this at the start of your app, to make sure Batch always gets a valid token after app updates.

    Returns void

  • Ask iOS users if they want to accept push notifications. Required to be able to push users. No effect on Android.

    Returns void

    Use requestNotificationAuthorization/requestProvisionalNotificationAuthorization and refreshToken

  • 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.

    Returns void

  • 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.

    Returns void

  • Change the used remote notification types on Android. (Ex: sound, vibrate, alert) Example : setAndroidNotificationTypes(batch.push.AndroidNotificationTypes.ALERT | batch.push.AndroidNotificationTypes.SOUND)

    Parameters

    Returns void

  • Change the used remote notification types on iOS. (Ex: sound, vibrate, alert) Example : setiOSNotificationTypes(batch.push.iOSNotificationTypes.ALERT | batch.push.iOSNotificationTypes.SOUND)

    Parameters

    Returns void

  • 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.

    Parameters

    • showForeground: boolean

    Returns void