The method allows using only Firebase to work with notifications for all platforms.
This method is a setter and should be used before the `.initPush()` initialization method described below.
Syntax and parameters
pcsdk.firebase_only(param);
Name
Type
Requirement
Description
param
boolean
required
Use true value to make the SDK for all platforms work only with Firebase. The false value (default) will allow to use APNs (Apple Push Notification) and other providers directly bypassing Firebase.
Example of use
pcsdk.firebase_only(true);
Asking For Token
Method Objective
The method allows managing the token request for push notifications.
This method is a setter and should be used before the `.initPush()` initialization method described below.
Syntax and parameters
pcsdk.askPushPermissions(param);
Name
Type
Requirement
Description
param
boolean
optionally
The true value (the default) allows the token to be requested, and false disallows it.
Example of use
pcsdk.askPushPermissions(false);
Initialization
Method Objective
The method allows sending click tracking to the system, displaying a simple notification by the SDK, and sending the data necessary to track and display the notification to the user's methods via a callback.
// Click tracking and showing the simple notification by the SDK
pcsdk.initPush();
// Custom method for click tracking, but showing simple notification by the SDK
pcsdk.initPush(onClickCallback);
// Click tracking and showing simple notification by the SDK, but showing notification by custom method for background mode
pcsdk.initPush(false, false, onBackgroundReceiveCallback);
// Click tracking by the SDK, but showing notifications including in the background by custom methods
pcsdk.initPush(false, onReceiveCallback, onBackgroundReceiveCallback);
// Click tracking and showing notifications including in the background by custom methods
pcsdk.initPush(onClickCallback, onReceiveCallback, onBackgroundReceiveCallback);
Actions Tracking
const params = {
code: 'CODE',
type: 'TYPE'
};
// Track user click notification
pcsdk.notificationClicked(params);
// Track Notification received
pcsdk.notificationReceived(params);