Skip to content
This repository has been archived by the owner on Feb 7, 2019. It is now read-only.

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
fix the Android callback onMessageReceived signature (message parameter is removed)
  • Loading branch information
lini authored Dec 13, 2017
1 parent 9d8a8fd commit 284905e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ In the Command prompt / Terminal navigate to your application root folder and ru

tns platform add android

- Add the `google-settings.json` file with the FCM configuration to the `app/App_Resources/Android folder` in your app
- Add the `google-settings.json` file with the FCM configuration to the `app/App_Resources/Android folder` in your app. If this file is not added, building the app for android will fail.

The plugin will default to version 11.4.2 of the `firebase-messaging` SDK. If you need to change the version, you can add a project ext property `firebaseMessagingVersion` like so:

Expand Down Expand Up @@ -84,7 +84,7 @@ Add code in your view model or compoent to subscribe and receive messages (don't

tns run android

- The access token is written in the console and displayed on the device after the plugin sucessfully subscribes to receive notifications. When notification comes, the message will be displayed in the notification area if the app is closed or on screen if the app is open.
- The access token is written in the console and displayed on the device after the plugin sucessfully subscribes to receive notifications. When a notification comes, the message will be displayed in the notification area if the app is closed or handled directly in the onMessageReceived callback if the app is open.

### iOS

Expand Down Expand Up @@ -330,7 +330,6 @@ The `categories` array from the iOS interactive settings contains:

| Parameter | Type | Description |
| --- | --- | --- |
| message | String | The notification message (if available). |
| stringifiedData | String | A string containing JSON data from the notification |
| fcmNotification | Object | iOS/Android | Function | The FCMNotification object. |

Expand Down Expand Up @@ -462,7 +461,7 @@ When in background mode, a notification is constructed according to the values o

#### Handling **Notification** Messages

If the app is in foreground, it invokes the `onMessageReceived` callback with three arguments (stringifiedData, fcmNotification).
If the app is in foreground, it invokes the `onMessageReceived` callback with two arguments (stringifiedData, fcmNotification).

If the app is in background, a notification is put in the tray. When tapped, it launches the app, but does not invoke the `onMessageReceived` callback.

Expand Down Expand Up @@ -494,9 +493,8 @@ application.on(application.resumeEvent, function(args) {

#### Parameters of the onMessageReceived Callback

Depending on the notification event and payload, the `onMessageReceived` callback is invoked with up to three arguments.
Depending on the notification event and payload, the `onMessageReceived` callback is invoked with two arguments.

* `message` - *String*. A string representation of the `data.message` value in the notification payload.
* `stringifiedData` - *String*. A stringified JSON representation of the `data` value in the notification payload.
* `fcmNotification` - `RemoteMessage.Notification`. A representation of the `RemoteMessage.Notification` class which can be accessed according to its public methods. This parameter is available in case the callback was called from a message with a `notification` key in the payload.

Expand Down

0 comments on commit 284905e

Please sign in to comment.