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

Commit 284905e

Browse files
authored
update README
fix the Android callback onMessageReceived signature (message parameter is removed)
1 parent 9d8a8fd commit 284905e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ In the Command prompt / Terminal navigate to your application root folder and ru
2626

2727
tns platform add android
2828

29-
- Add the `google-settings.json` file with the FCM configuration to the `app/App_Resources/Android folder` in your app
29+
- 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.
3030

3131
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:
3232

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

8585
tns run android
8686

87-
- 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.
87+
- 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.
8888

8989
### iOS
9090

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

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

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

463462
#### Handling **Notification** Messages
464463

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

467466
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.
468467

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

495494
#### Parameters of the onMessageReceived Callback
496495

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

499-
* `message` - *String*. A string representation of the `data.message` value in the notification payload.
500498
* `stringifiedData` - *String*. A stringified JSON representation of the `data` value in the notification payload.
501499
* `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.
502500

0 commit comments

Comments
 (0)