React native wrapper library for Unifonic Push
npm install react-native-unifonic-push
OR
yarn add react-native-unifonic-push
import { UnifonicPush } from 'react-native-unifonic-push';
// ...
const unifonicPush = new UnifonicPush(true);
const token = await unifonicPush.register("appId", "identifier");
The library exposes a single class UnifonicPush
The class has the following attributes and methods:
constructor(isDev = false)
isDev
=> Optional boolean parameter to connect to development server. Defaults to false
storedAppId
=> returns the application id stored locallystoredIdentifier
=> returns the identifier stored locallysdkToken
=> returns the sdk token stored locallypushToken
=> returns the push token stored locally
register
=> Registers your app with Unifonic Parameters: a.appId
: Refers to the App ID you receive from Unifonic b.identifier
: A unique identifier Returns:sdkToken
: A token that you can use as authorization in subsequent requestsmarkNotification
=> Mark a notification as eitherread
orreceived
Parameters: a.type
: NotificationReadType (read/received) b.messageId
: Message ID received in push notification's payload Returns:boolean
:true
in case of success,false
otherwiseenableNotification
: Enables the notifications for the current device Returns:boolean
:true
in case of success,false
otherwisedisableNotification
: Disables the notifications for the current device Returns:boolean
:true
in case of success,false
otherwisesaveToken
: Sends the push-token to Unifonic backend Parameters:pushToken
:apn
in case of iOS,fcm
in case of Android Returns:boolean':
truein case of success,
false` otherwise
MIT
Made with create-react-native-library