diff --git a/docs/API.md b/docs/API.md index 182b08149..0d80178f5 100644 --- a/docs/API.md +++ b/docs/API.md @@ -41,25 +41,25 @@ All available option attributes are described bellow. Currently, there are no Wi #### Android -| Attribute | Type | Default | Description | -| ---------------------------- | --------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `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]() | -| `android.sound` | `boolean` | `true` | Optional. If `true` it plays the sound specified in the push data or the default system sound. | -| `android.vibrate` | `boolean` | `true` | Optional. If `true` the device vibrates on receipt of notification. | -| `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 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. | +| Attribute | Type | Default | Description | +| ---------------------------- | --------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `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]() | +| `android.sound` | `boolean` | `true` | Optional. If `true` it plays the sound specified in the push data or the default system sound. | +| `android.vibrate` | `boolean` | `true` | Optional. If `true` the device vibrates on receipt of notification. | +| `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 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. | +| 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 @@ -72,7 +72,7 @@ All iOS boolean options can also be specified as `string` | `ios.badge` | `boolean` | `false` | Optional. If `true` the device sets the badge number on receipt of notification. **Note:** the value you set this option to the first time you call the init method will be how the application always acts. Once this is set programmatically in the init method it can only be changed manually by the user in Settings>Notifications>`App Name`. This is normal iOS behaviour. | | `ios.sound` | `boolean` | `false` | Optional. If `true` the device plays a sound on receipt of notification. **Note:** the value you set this option to the first time you call the init method will be how the application always acts. Once this is set programmatically in the init method it can only be changed manually by the user in Settings>Notifications>`App Name`. This is normal iOS behaviour. | | `ios.clearBadge` | `boolean` | `false` | Optional. If `true` the badge will be cleared on app startup. | -| `ios.categories` | `Object` | `{}` | Optional. The data required in order to enabled Action Buttons for iOS. See [Action Buttons on iOS](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#action-buttons-1) for more details. | +| `ios.categories` | `Object` | `{}` | Optional. The data required in order to enable Action Buttons for iOS. See [Action Buttons on iOS](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#action-buttons-1) for more details. | #### iOS GCM support @@ -108,7 +108,7 @@ This type of notifications consist only of payload data, so the developer is the In order to use the VoIP Notifications, you have to create a VoIP Services Certificate. There are a lot of tutorials on the web to achieve this. Once created, you must use this certificate in order to communicate with the APN Service. -To set up the VoIP Notification in ios do: +To set up the VoIP Notification in iOS do: ```javascript const push = PushNotification.init({ diff --git a/types/index.d.ts b/types/index.d.ts index 33a003f4e..d48511e88 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -120,10 +120,6 @@ declare namespace PhonegapPluginPush { * Android specific initialization options. */ android?: { - /** - * Maps to the project number in the Google Developer Console. - */ - senderID: string /** * The name of a drawable resource to use as the small-icon. The name should not include the extension. */ @@ -141,6 +137,10 @@ declare namespace PhonegapPluginPush { * If true the device vibrates on receipt of notification. Default is true. */ vibrate?: boolean + /** + * If true the icon badge will be cleared on init and before push messages are processed. Default is false. + */ + clearBadge?: boolean /** * If true the app clears all pending notifications when it is closed. Default is true. */ @@ -153,12 +153,40 @@ declare namespace PhonegapPluginPush { * If the array contains one or more strings each string will be used to subscribe to a GcmPubSub topic. */ topics?: string[] + /** + * The key to search for text of notification. Default is 'message'. + */ + messageKey?: string + /** + * The key to search for title of notification. Default is 'title'. + */ + titleKey?: string + } + + /** + * Browser specific initialization options. + */ + browser?: { + /** + * URL for the push server you want to use. Default is 'http://push.api.phonegap.com/v1/push'. + */ + pushServiceURL?: string + /** + * Your GCM API key if you are using VAPID keys. + */ + applicationServerKey?: string } /** * iOS specific initialization options. */ ios?: { + /** + * If true|"true" the device will be set up to receive VoIP Push notifications and the other options will be ignored + * since VoIP notifications are silent notifications that should be handled in the "notification" event. + * Default is false|"false". + */ + voip?: boolean | string /** * If true|"true" the device sets the badge number on receipt of notification. * Default is false|"false". @@ -184,7 +212,7 @@ declare namespace PhonegapPluginPush { */ alert?: boolean | string /** - * If true|"true" the badge will be cleared on app startup. Default is false|"false". + * If true|"true" the badge will be cleared on app startup. Defaults to false|"false". */ clearBadge?: boolean | string /** @@ -192,16 +220,12 @@ declare namespace PhonegapPluginPush { * Action Buttons on iOS - https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#action-buttons-1 */ categories?: CategoryArray - /** - * Maps to the project number in the Google Developer Console. Setting this uses GCM for notifications instead of native - */ - senderID?: string /** * Whether to use prod or sandbox GCM setting. Defaults to false. */ fcmSandbox?: boolean /** - * 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 + * If the array contains one or more strings each string will be used to subscribe to a FcmPubSub topic. Defaults to []. */ topics?: string[] }