BatchPush: {
    AndroidNotificationTypes: IAndroidNotificationTypes;
    clearBadge: (() => void);
    dismissNotifications: (() => void);
    getInitialURL: (() => Promise<string>);
    getLastKnownPushToken: (() => Promise<string>);
    refreshToken: (() => void);
    registerForRemoteNotifications: (() => void);
    requestNotificationAuthorization: (() => void);
    requestProvisionalNotificationAuthorization: (() => void);
    setAndroidNotificationTypes: ((notificationTypes: number[]) => void);
    setShowForegroundNotification: ((enabled: boolean) => void);
    addListener(eventType: "open" | "display" | "dismiss", callback: ((payload: BatchPushEventPayload) => void)): EmitterSubscription;
} = ...

Batch's push module

Type declaration

  • AndroidNotificationTypes: IAndroidNotificationTypes
  • clearBadge: (() => void)

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

      • (): void
      • Returns void

  • dismissNotifications: (() => void)

    Dismiss the app's shown notifications on iOS. Should be called on startup.

    No effect on Android.

      • (): void
      • Returns void

  • getInitialURL: (() => Promise<string>)

    Gets the app's initial URL.

    On iOS, make sure to call this only once (only the first call will return something, if Linking.getInitialURL doesn't return anything)

      • (): Promise<string>
      • Returns Promise<string>

  • getLastKnownPushToken: (() => Promise<string>)

    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.

      • (): Promise<string>
      • Returns Promise<string>

  • refreshToken: (() => void)

    Synchronizes the user's iOS token with Batch. Should be called at each app launch.

    No effect on Android.

      • (): void
      • Returns void

  • registerForRemoteNotifications: (() => void)

    Ask iOS users if they want to accept push notifications. Required to be able to push users.

    No effect on Android.

    Please use requestNotificationAuthorization to request permission when needed, and requestToken at each app launch

      • (): void
      • Returns void

  • requestNotificationAuthorization: (() => void)

    Ask users if they want to accept push notifications. Required to be able to push users (or use requestProvisionalNotificationAuthorization - ios only).

      • (): void
      • Returns void

  • requestProvisionalNotificationAuthorization: (() => void)

    Ask iOS for provisional notifications (no alert to users). Required to be able to push users (or use requestNotificationAuthorization).

    No effect on Android.

      • (): void
      • Returns void

  • setAndroidNotificationTypes: ((notificationTypes: number[]) => void)

    Change the used remote notification types on Android. (Ex: sound, vibrate, alert)

    Does not work with iOS

    Example : setAndroidNotificationTypes(batch.push.AndroidNotificationTypes.ALERT | batch.push.AndroidNotificationTypes.SOUND)

      • (notificationTypes): void
      • Parameters

        • notificationTypes: number[]

        Returns void

  • setShowForegroundNotification: ((enabled: boolean) => void)
      • (enabled): void
      • Parameters

        • enabled: boolean

        Returns void

  • addListener:function