Example

import Notifications from '@smartface/native/notifications';
Notifications.registerForPushNotifications(function(e){
console.log("Successfully registered. The token is: " + e.token);
},function(){
console.log("Register failed.");
});

Hierarchy

Properties

_nativeObject: any
iOS: { AuthorizationStatus?: typeof AuthorizationStatus; NotificationPresentationOptions?: typeof NotificationPresentationOptions }

Type declaration

Android: { Priority?: typeof Priority }

Type declaration

Accessors

  • get nativeObject(): any
  • Returns any

  • set nativeObject(value: any): void
  • Parameters

    • value: any

    Returns void

  • get ios(): TProps["ios"]
  • Returns TProps["ios"]

  • get android(): TProps["android"]
  • Returns TProps["android"]

Methods

  • Executed before everything. This should return nativeObject since it will be assinged directly to nativeObject.

    Parameters

    • Optional params: Partial<Record<string, any>>

    Returns any

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns (() => void)

      • (): void
      • Returns void

  • Parameters

    Returns (() => void)

      • (): void
      • Returns void

  • Parameters

    Returns void

  • Parameters

    • event: "notificationReceive" | "notificationClick"
    • Rest ...args: any[]

    Returns void

  • Parameters

    • Optional params: Partial<Record<string, any>>

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Cancel all presented or scheduled local notifications.

    Method

    cancelAllLocalNotifications

    Android

    Ios

    Static

    Since

    0.1

    Deprecated

    4.0.8 Use removeAllDeliveredNotifications

    Returns void

  • Register for remote push notifications. For emulator this will not work and always calls onFailure callback. This function uses senderID inside of project.json file for registering push notification services. You can obtain registration token from onSuccess callback's argument's 'token' property.

    You can receive push notification data from Application.onReceivedNotification when push notification arrives.

    Method

    registerForPushNotifications

    Android

    Ios

    Static

    Since

    0.1

    Parameters

    • onSuccess: ((__namedParameters: Object) => void)
        • (__namedParameters: Object): void
        • Parameters

          • __namedParameters: Object

          Returns void

    • onFailure: (() => void)
        • (): void
        • Returns void

    Returns void

  • Unregister for remote push notifications. For emulator this will not work and does nothing.

    Method

    unregisterForPushNotifications

    Android

    Ios

    Static

    Since

    0.1

    Returns void

  • Gets authorization status.

    Method

    getAuthorizationStatus

    Ios

    Static

    Since

    2.0.11

    Parameters

    Returns void

  • Use this method to remove all of your app’s delivered notifications.

    Method

    removeAllDeliveredNotifications

    Ios

    Android

    Static

    Since

    4.0.8

    Returns void

Events

onNotificationReceive: ((data: any) => NotificationPresentationOptions[])

Type declaration

    • (data: any): NotificationPresentationOptions[]
    • Handles a notification messages that arrived while the app was running in the foreground for iOS but Android handles while in the foreground or background. In iOS, the return value specifies how you want the system to alert the user, if at all. So return values does not effect in Android.

      Example

      Notifications.onNotificationReceive = function(e){
      console.log("willPresentNotification", e);
      return [Notifications.iOS.NotificationPresentationOptions.SOUND,Notifications.iOS.NotificationPresentationOptions.ALERT]; // or []
      };

      @event onNotificationReceive

      Deprecated

      Returns

      Specify [] to silence the notification completely.

      Ios

      Android

      Static

      Since

      4.0.3

      Example

      import Notifications from '@smartface/native/global/natifications';

      Notifications.on(Notifications.Events.NotificationReceive, (params) => {
      console.info('onNotificationReceive', params);
      });

      Parameters

      • data: any

      Returns NotificationPresentationOptions[]

onNotificationClick: ((data: any) => void)

Type declaration

    • (data: any): void
    • This event triggered when clicked on notification alert

      onNotificationClick

      Deprecated

      Ios

      Android

      Static

      Since

      4.0.3

      Example

      import Notifications from '@smartface/native/global/natifications';

      Notifications.on(Notifications.Events.NoficationClick, (params) => {
      console.info('onNotificationClick', params);
      });

      Parameters

      • data: any

      Returns void

Generated using TypeDoc