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

Commit 5784001

Browse files
authored
Merge pull request #183 from NativeScript/lini/update-docs-android
update docs for android troubleshooting
2 parents 3d1d99e + e11afcb commit 5784001

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,8 @@ In case the application doesn't work as expected. Here are some things you can v
413413

414414
### Android
415415

416+
- When the application is started using `tns run android` (i.e. in debug mode with livesync) some background notifications might not be received correctly. This happens because the app is not started in a normal way for debugging and the resume from background happens differently. To receive all notifications correctly, stop the app (swipe it away it from the recent apps list) and start it again by tapping the app icon on the device.
417+
416418
- Ensure that the AndroidManifest.xml located at platforms/android/build/... (**do not add it in your "App_Resources/Android/AndroidManifest.xml" file**) contains the following snippets for registering the GCM listener:
417419

418420
```XML
@@ -491,11 +493,13 @@ The behavior of the `onMessageReceived` callback in the module follows the behav
491493

492494
The `onMessageReceived` method of the plugin is called each time a `data` notification is received.
493495

494-
When in background mode, a notification is constructed according to the values of the key specified above and placed in the tray. Tapping the notification launches the app and invokes the `onMessageReceived` callback.
496+
If the app is stopped or suspended, NO notification is constructed and placed in the tray. Tapping the app icon launches the app and invokes the `onMessageReceived` callback where you will receive the notification data.
497+
498+
If the app is active and in foreground, the `onMessageReceived` callback is invoked immediately with the notification data (fcmNotification).
495499

496500
#### Handling **Notification** Messages
497501

498-
If the app is in foreground, it invokes the `onMessageReceived` callback with two arguments (stringifiedData, fcmNotification).
502+
If the app is active and in foreground, it invokes the `onMessageReceived` callback with two arguments (stringifiedData, fcmNotification).
499503

500504
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.
501505

0 commit comments

Comments
 (0)