summaryrefslogtreecommitdiff
path: root/StoneIsland/plugins/phonegap-plugin-push/docs/API.md
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/plugins/phonegap-plugin-push/docs/API.md')
-rw-r--r--StoneIsland/plugins/phonegap-plugin-push/docs/API.md32
1 files changed, 18 insertions, 14 deletions
diff --git a/StoneIsland/plugins/phonegap-plugin-push/docs/API.md b/StoneIsland/plugins/phonegap-plugin-push/docs/API.md
index e0481af8..866fd28c 100644
--- a/StoneIsland/plugins/phonegap-plugin-push/docs/API.md
+++ b/StoneIsland/plugins/phonegap-plugin-push/docs/API.md
@@ -11,7 +11,7 @@
- [push.subscribe()](#pushsubscribetopic-successhandler-errorhandler)
- [push.unsubscribe()](#pushunsubscribetopic-successhandler-errorhandler)
- [push.setApplicationIconBadgeNumber() - iOS & Android only](#pushsetapplicationiconbadgenumbersuccesshandler-errorhandler-count---ios--android-only)
-- [push.getApplicationIconBadgeNumber() - iOS only](#pushgetapplicationiconbadgenumbersuccesshandler-errorhandler---ios-only)
+- [push.getApplicationIconBadgeNumber() - iOS & Android only](#pushgetapplicationiconbadgenumbersuccesshandler-errorhandler---ios--android-only)
- [push.finish() - iOS only](#pushfinishsuccesshandler-errorhandler-id---ios-only)
- [push.clearAllNotifications() - iOS & Android only](#pushclearallnotificationssuccesshandler-errorhandler---ios--android-only)
@@ -39,7 +39,6 @@ All available option attributes are described bellow. Currently, there are no Wi
Attribute | Type | Default | Description
--------- | ---- | ------- | -----------
-`android.senderID` | `string` | | Maps to the project number in the Google Developer Console.
`android.icon` | `string` | | Optional. The name of a drawable resource to use as the small-icon. The name should not include the extension.
`android.iconColor` | `string` | | Optional. Sets the background color of the small icon on Android 5.0 and greater. [Supported Formats](http://developer.android.com/reference/android/graphics/Color.html#parseColor(java.lang.String))
`android.sound` | `boolean` | `true` | Optional. If `true` it plays the sound specified in the push data or the default system sound.
@@ -47,13 +46,16 @@ Attribute | Type | Default | Description
`android.clearBadge` | `boolean` | `false` | Optional. If `true` the icon badge will be cleared on init and before push messages are processed.
`android.clearNotifications` | `boolean` | `true` | Optional. If `true` the app clears all pending notifications when it is closed.
`android.forceShow` | `boolean` | `false` | Optional. Controls the behavior of the notification when app is in foreground. If `true` and app is in foreground, it will show a notification in the notification drawer, the same way as when the app is in background (and `on('notification')` callback will be called *only when the user clicks the notification*). When `false` and app is in foreground, the `on('notification')` callback will be called immediately.
-`android.topics` | `array` | `[]` | Optional. If the array contains one or more strings each string will be used to subscribe to a GcmPubSub topic.
+`android.topics` | `array` | `[]` | Optional. If the array contains one or more strings each string will be used to subscribe to a FcmPubSub topic.
+`android.messageKey` | `string` | `message` | Optional. The key to search for text of notification.
+`android.titleKey` | `string` | `'title'` | Optional. The key to search for title of notification.
#### Browser
Attribute | Type | Default | Description
--------- | ---- | ------- | -----------
`browser.pushServiceURL` | `string` | `http://push.api.phonegap.com/v1/push` | Optional. URL for the push server you want to use.
+`browser.applicationServerKey` | `string` | `` | Optional. Your GCM API key if you are using VAPID keys.
#### iOS
@@ -73,9 +75,9 @@ The following properties are used if you want use GCM on iOS.
Attribute | Type | Default | Description
--------- | ---- | ------- | -----------
-`ios.senderID` | `string` | `undefined` (Native) | Maps to the project number in the Google Developer Console. Setting this uses GCM for notifications instead of native
-`ios.gcmSandbox` | `boolean` | `false` | Whether to use prod or sandbox GCM setting. Defaults to false.
-`ios.topics` | `array` | `[]` | Optional. If the array contains one or more strings each string will be used to subscribe to a GcmPubSub topic. Note: only usable in conjunction with `senderID`.
+`ios.fcmSandbox` | `boolean` | `false` | Whether to use prod or sandbox GCM setting. Defaults to false.
+options
+`ios.topics` | `array` | `[]` | Optional. If the array contains one or more strings each string will be used to subscribe to a FcmPubSub topic.
##### How GCM on iOS works.
@@ -85,12 +87,12 @@ What happens is on the device side is that it registers with APNS, then that reg
When you send a message to GCM using that ID, what it does is look up the APNS registration ID on it's side and forward the message you sent to GCM on to APSN to deliver to your iOS device.
-Make sure that the certificate you build with matches your `gcmSandbox` value.
+Make sure that the certificate you build with matches your `fcmSandbox` value.
-- If you build your app as development and set `gcmSandbox: false` it will fail.
-- If you build your app as production and set `gcmSandbox: true` it will fail.
-- If you build your app as development and set `gcmSandbox: true` but haven't uploaded the development certs to Google it will fail.
-- If you build your app as production and set `gcmSandbox: false` but haven't uploaded the production certs to Google it will fail.
+- If you build your app as development and set `fcmSandbox: false` it will fail.
+- If you build your app as production and set `fcmSandbox: true` it will fail.
+- If you build your app as development and set `fcmSandbox: true` but haven't uploaded the development certs to Google it will fail.
+- If you build your app as production and set `fcmSandbox: false` but haven't uploaded the production certs to Google it will fail.
> Note: The integration between GCM and APNS is a bit finicky. Personally, I feel it is much better to send pushes to Android using GCM and pushes to iOS using APNS which this plugin does support.
@@ -99,7 +101,6 @@ Make sure that the certificate you build with matches your `gcmSandbox` value.
```javascript
var push = PushNotification.init({
android: {
- senderID: "12345679"
},
browser: {
pushServiceURL: 'http://push.api.phonegap.com/v1/push'
@@ -159,12 +160,14 @@ The event `registration` will be triggered on each successful registration with
Parameter | Type | Description
--------- | ---- | -----------
`data.registrationId` | `string` | The registration ID provided by the 3rd party remote push service.
+`data.registrationType` | `string` | The registration type of the 3rd party remote push service. Either FCM or APNS.
### Example
```javascript
push.on('registration', function(data) {
- console.log(data.registrationId);
+ console.log(data.registrationId);
+ console.log(data.registrationType);
});
```
@@ -203,6 +206,7 @@ Parameter | Type | Description
`data.additionalData` | `Object` | An optional collection of data sent by the 3rd party push service that does not fit in the above properties.
`data.additionalData.foreground` | `boolean` | Whether the notification was received while the app was in the foreground
`data.additionalData.coldstart` | `boolean` | Will be `true` if the application is started by clicking on the push notification, `false` if the app is already started.
+`data.additionalData.dismissed` | `boolean` | Is set to `true` if the notification was dismissed by the user
### Example
@@ -352,7 +356,7 @@ push.setApplicationIconBadgeNumber(function() {
}, 2);
```
-## push.getApplicationIconBadgeNumber(successHandler, errorHandler) - iOS only
+## push.getApplicationIconBadgeNumber(successHandler, errorHandler) - iOS & Android only
Get the current badge count visible when the app is not running