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
  • set nativeObject(value: any): void
  • Returns any

  • Parameters

    • value: any

    Returns void

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

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

Methods

  • createNativeObject(params?: Partial<Record<string, any>>): any
  • Executed before everything. This should return nativeObject since it will be assinged directly to nativeObject.

    Parameters

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

    Returns any

  • prependListener(eventName: "notificationReceive" | "notificationClick", callback: EventListenerCallback): void
  • Parameters

    Returns void

  • prependOnceListener(eventName: "notificationReceive" | "notificationClick", callback: EventListenerCallback): void
  • Parameters

    Returns void

  • Parameters

    Returns () => void

      • (): void
      • Returns void

  • once(eventName: "notificationReceive" | "notificationClick", callback: EventListenerCallback): () => void
  • Parameters

    Returns () => void

      • (): void
      • Returns void

  • Parameters

    Returns void

  • emit(event: "notificationReceive" | "notificationClick", ...args: any[]): void
  • Parameters

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

    Returns void

  • preConstruct(params?: Partial<Record<string, any>>): void
  • Parameters

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

    Returns void

  • addAndroidProps(props: Partial<{ [key: string]: any }> & Partial<{}>): void
  • Parameters

    • props: Partial<{ [key: string]: any }> & Partial<{}>

    Returns void

  • Parameters

    Returns void

  • cancelAllLocalNotifications(): void
  • Cancel all presented or scheduled local notifications.

    Method

    cancelAllLocalNotifications

    Android

    Ios

    Static

    Since

    0.1 4.0.8 Use Notifications#removeAllDeliveredNotifications

    Returns void

  • registerForPushNotifications(onSuccess: (__namedParameters: Object) => void, onFailure: () => void): 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

  • unregisterForPushNotifications(): 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

  • removeAllDeliveredNotifications(): 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

  • 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 []
    };

    onNotificationReceive

    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
  • This event triggered when clicked on notification alert

    onNotificationClick

    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