Push
$ ionic plugin add phonegap-plugin-push
Repo: https://github.com/phonegap/phonegap-plugin-push
Register and receive push notifications.
Requires Cordova plugin: phonegap-plugin-push
. For more info, please see the Push plugin docs.
For TypeScript users, see the Push plugin docs about using TypeScript for custom notifications.
Usage
import {Push} from 'ionic-native';
Static Methods
init(options)
Initialize the plugin on the native side.
var push = Push.init({
android: {
senderID: "12345679"
},
ios: {
alert: "true",
badge: true,
sound: 'false'
},
windows: {}
});
Param | Type | Details |
---|---|---|
options |
PushOptions
|
The Push options. |
Returns:
PushNotification
Returns a new PushNotification object.
hasPermission()
Check whether the push notification permission has been granted.
Returns:
Promise
Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted.