Options
All
  • Public
  • Public/Protected
  • All
Menu

@bam.tech/react-native-batch

Index

Variables

AndroidNotificationTypes

AndroidNotificationTypes: IAndroidNotificationTypes = RNBatch.NOTIFICATION_TYPES

Batch

Batch: { optIn: () => Promise<void>; optOut: () => Promise<void>; optOutAndWipeData: () => Promise<void>; showDebugView: () => void } = ...

Batch React-Native Module

Type declaration

  • optIn: () => Promise<void>
      • (): Promise<void>
      • Opt In to Batch SDK Usage.

        This method will be taken into account on next full application start (full process restart)

        Only useful if you called batch.optOut() or batch.optOutAndWipeData() or opted out by default in the manifest

        Some features might not be disabled until the next app start if you call this late into the application's life. It is strongly advised to restart the application (or at least the current activity) after opting in.

        Returns Promise<void>

  • optOut: () => Promise<void>
      • (): Promise<void>
      • Opt Out from Batch SDK Usage

        Note that calling the SDK when opted out is discouraged: Some modules might behave unexpectedly when the SDK is opted-out from.

        Opting out will:

        • Prevent batch.start()
        • Disable any network capability from the SDK
        • Disable all In-App campaigns
        • Make the Inbox module return an error immediatly when used
        • Make the SDK reject any editor calls
        • Make the SDK reject calls to batch.user.trackEvent(), batch.user.trackTransaction(), batch.user.trackLocation() and any related methods

        Even if you opt in afterwards, data that has been generated while opted out WILL be lost.

        If you're also looking at deleting user data, please use batch.optOutAndWipeData()

        Note that calling this method will stop Batch. Your app should be prepared to handle these cases. Some features might not be disabled until the next app start.

        Returns Promise<void>

  • optOutAndWipeData: () => Promise<void>
      • (): Promise<void>
      • Opt Out from Batch SDK Usage

        Same as batch.optOut(Context) but also wipes data.

        Note that calling this method will stop Batch. Your app should be prepared to handle these cases.

        Returns Promise<void>

  • showDebugView: () => void

BatchEventEmitter

BatchEventEmitter: NativeEventEmitter = ...

BatchInbox

BatchInbox: { NotificationSource: typeof NotificationSource; getFetcher: any } = ...

Batch's inbox module

Type declaration

BatchMessaging

BatchMessaging: { disableDoNotDisturbAndShowPendingMessage: () => Promise<void>; setFontOverride: (normalFontName?: string, boldFontName?: string, italicFontName?: string, italicBoldFontName?: string) => Promise<void>; setNotDisturbed: (active: boolean) => Promise<void>; showPendingMessage: () => Promise<void>; addListener: any } = ...

Type declaration

  • disableDoNotDisturbAndShowPendingMessage: () => Promise<void>
      • (): Promise<void>
      • Disables do not disturb mode and shows the currently enqueued message, if any.

        Returns Promise<void>

  • setFontOverride: (normalFontName?: string, boldFontName?: string, italicFontName?: string, italicBoldFontName?: string) => Promise<void>
      • (normalFontName?: string, boldFontName?: string, italicFontName?: string, italicBoldFontName?: string): Promise<void>
      • Override the font used in message views. Not applicable for standard alerts. iOS Android

        Parameters

        • Optional normalFontName: string
        • Optional boldFontName: string
        • Optional italicFontName: string

          (iOS only)

        • Optional italicBoldFontName: string

          (iOS only)

        Returns Promise<void>

  • setNotDisturbed: (active: boolean) => Promise<void>
      • (active: boolean): Promise<void>
      • Define if incoming messages have to be enqueued or displayed directly

        Parameters

        • active: boolean

        Returns Promise<void>

  • showPendingMessage: () => Promise<void>
      • (): Promise<void>
      • Shows the currently enqueued message, if any.

        Returns Promise<void>

  • addListener:function

BatchPush

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; addListener: any } = ...

Batch's push module

Type declaration

  • AndroidNotificationTypes: IAndroidNotificationTypes
  • clearBadge: () => void
      • (): void
      • Clear the app badge on iOS. No effect on Android.

        Returns void

  • dismissNotifications: () => void
      • (): void
      • Dismiss the app's shown notifications on iOS. Should be called on startup.

        No effect on Android.

        Returns void

  • getInitialURL: () => Promise<string>
      • (): 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)

        Returns Promise<string>

  • getLastKnownPushToken: () => Promise<string>
      • (): 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.

        Returns Promise<string>

  • refreshToken: () => void
      • (): void
      • Synchronizes the user's iOS token with Batch. Should be called at each app launch.

        No effect on Android.

        Returns void

  • registerForRemoteNotifications: () => void
      • (): void
      • Ask iOS users if they want to accept push notifications. Required to be able to push users.

        No effect on Android.

        deprecated

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

        Returns void

  • requestNotificationAuthorization: () => void
      • (): void
      • Ask iOS users if they want to accept push notifications. Required to be able to push users (or use requestProvisionalNotificationAuthorization).

        No effect on Android.

        Returns void

  • requestProvisionalNotificationAuthorization: () => void
      • (): void
      • Ask iOS for provisional notifications (no alert to users). Required to be able to push users (or use requestNotificationAuthorization).

        No effect on Android.

        Returns void

  • setAndroidNotificationTypes: (notificationTypes: number[]) => void
      • (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)

        Parameters

        • notificationTypes: number[]

        Returns void

  • addListener:function

BatchUser

BatchUser: { editor: () => BatchUserEditor; getInstallationID: () => Promise<string>; trackEvent: (name: string, label?: string, data?: BatchEventData) => void; trackLocation: (location: Location) => void; trackTransaction: (amount: number, data?: {}) => void } = ...

Batch's user module

Type declaration

  • editor: () => BatchUserEditor
      • (): BatchUserEditor
      • Creates an editor for the user profile The profile is not updated until the method save() is called

        Returns BatchUserEditor

  • getInstallationID: () => Promise<string>
      • (): Promise<string>
      • Get the unique installation ID, generated by Batch. Batch must be started to read it. You will get the result in a promise.

        Returns Promise<string>

  • trackEvent: (name: string, label?: string, data?: BatchEventData) => void
      • Track an event. Batch must be started at some point, or events won't be sent to the server.

        Parameters

        • name: string

          The event name. Must be a string.

        • Optional label: string

          The event label (optional). Must be a string.

        • Optional data: BatchEventData

          The event data (optional). Must be an object.

        Returns void

  • trackLocation: (location: Location) => void
      • Track a geolocation update You can call this method from any thread. Batch must be started at some point, or location updates won't be sent to the server.

        Parameters

        • location: Location

          User location object

        Returns void

  • trackTransaction: (amount: number, data?: {}) => void
      • (amount: number, data?: {}): void
      • Track a transaction. Batch must be started at some point, or events won't be sent to the server.

        Parameters

        • amount: number

          Transaction's amount.

        • Optional data: {}

          The transaction data (optional). Must be an object.

          • [key: string]: any

        Returns void

Consts

Consts: { AttributeKeyRegexp: RegExp; EventDataMaxTags: number; EventDataMaxValues: number; EventDataStringMaxLength: number; EventDataURLMaxLength: number } = ...

Type declaration

  • AttributeKeyRegexp: RegExp
  • EventDataMaxTags: number
  • EventDataMaxValues: number
  • EventDataStringMaxLength: number
  • EventDataURLMaxLength: number

Generated using TypeDoc