Notifications
Class that provides notification capabilities. Callers should use
MobileBackend's notifications property.
- Source:
Methods
deregisterForNotifications(deviceToken, packageName, notificationProvider) → {Promise.<NetworkResponse>}
Deregisters the current Cordova app running on the device for receiving push notifications.
Parameters:
Name | Type | Description |
---|---|---|
deviceToken |
String | Platform-specific success callback token. |
packageName |
String | Platform-specific application reverse domain identifier. |
notificationProvider |
String | The provider to register, posible values: 'APNS', 'FCM', 'WNS', 'SYNIVERSE'. |
- Source:
Returns:
- Type
- Promise.<NetworkResponse>
Example
mcs.mobileBackend
.notifications
.deregisterForNotifications('YOUR_DEVICE_TOKEN', 'com.yourcompany.project', '1.0.0', 'FCM')
.then(deregisterSuccess)
.catch(deregisterError);
function deregisterSuccess(response){
console.log(response);
}
function deregisterError(response){
console.log(response);
}
getDevicePlatform() → {String}
Returns a string with device information used by Notifications
- Source:
Returns:
The device specific information for platform.
- Type
- String
Example
: 'IOS', 'ANDROID'
registerForNotifications(deviceToken, packageName, appVersion, notificationProvider) → {Promise.<NetworkResponse>}
Registers the current Cordova app running on the device for receiving push notifications.
Parameters:
Name | Type | Description |
---|---|---|
deviceToken |
String | Platform-specific device token. |
packageName |
String | Platform-specific application reverse domain identifier. |
appVersion |
String | Application version. |
notificationProvider |
String | The provider to register, possible values: 'APNS', 'FCM', 'WNS', 'SYNIVERSE'. |
- Source:
Returns:
- Type
- Promise.<NetworkResponse>
Example
mcs.mobileBackend
.notifications
.registerForNotifications('YOUR_DEVICE_TOKEN', 'com.yourcompany.project', '1.0.0', 'FCM')
.then(registerSuccess)
.catch(registerError);
function registerSuccess(response){
console.log(response);
}
function registerError(response){
console.error(response);
}