Notifications
Class that provides notification capabilities. Callers should use
MobileBackend's notifications property.
Methods
deregisterForNotifications(deviceToken, packageName) → {Promise.<NetworkResponse>}
Deregister from notifications.
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. |
Returns:
- Type
- Promise.<NetworkResponse>
Example
Example usage of mcs.mobileBackend.notifications.deregisterForNotifications()
mcs.mobileBackend
.notifications
.deregisterForNotifications('YOUR_DEVICE_TOKEN', 'com.yourcompany.project', '1.0.0')
.then(deregisterSuccess)
.catch(deregisterError);
function deregisterSuccess(response){
console.log(response);
}
function deregisterError(response){
console.log(response);
}
getDevicePlatform() → {String}
Get device platform.
Returns a string with device information used by Notifications
Returns:
The device specific information for platform.
- Type
- String
Example
: 'IOS', 'ANDROID'
registerForNotifications(deviceToken, packageName, appVersion, notificationProvider) → {Promise.<NetworkResponse>}
Register for notifications.
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 | Platform-specific application version. |
notificationProvider |
String | The provider to register, posible values: 'APNS', 'FCM', 'WNS', 'SYNIVERSE'. |
Returns:
- Type
- Promise.<NetworkResponse>
Example
Example usage of mcs.mobileBackend.notifications.registerForNotifications()
mcs.mobileBackend
.notifications
.registerForNotifications('YOUR_DEVICE_TOKEN', 'com.yourcompany.project', '1.0.0', 'GCM')
.then(registerSuccess)
.catch(registerError);
function registerSuccess(response){
console.log(response);
}
function registerError(response){
console.error(response);
}