Implements

  • PushModule

Constructors

Properties

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

  • 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

  • Adjust the way Batch will display Android notifications.

    You should use this method if you want to avoid notifications for this user. Note that Batch will remember this value, even if your Application reboots.

    Parameters

    • show: boolean

      Whether Batch should show notifications or not

    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 shown in the foreground on iOS. If true, notifications will be shown like if the user was outside your application and batchPushReceived will only be triggered when the notification is tapped.

    Parameters

    • showForeground: boolean

    Returns void

  • Whether Batch should show Android notifications or not.

    Default: true if you never used setAndroidShowNotifications().

    Returns Promise<undefined | boolean>

    Whether Batch should show notifications or not