You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 7, 2019. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 7, 2019. It is now read-only.
Data not being received in intent either in launching activity or application #175
When a notification from tray is clicked the app launches but no data is received in the intent. I have tried receiving the data in app.ts and my first view classes, for the events launchEvent and resumeEvent, but the data is received as empty whereas i am getting the data in onMessageReceived callback (stringified data).
The other issue is that the notification is received only a few time, when the app is in background. It happens randomly. Sometime the notification is received, sometimes it is not.
You should use the application's resume event instead of launch to handle the received notification. Take a look at the demo app's code for the push plugin on how exactly to extract the data from the intent:
@jogboms I dont have any launch mode configured in Manifest, if you are referring to NativeScriptActivity. @lini I have tried the similar configuration in app.ts file as mentioned in the original question. But still getting the data as empty.
I am seeing both the notification details (My title/My text) in the notification tray and when I tap on the notification and open the app, I am seeing the data there as well:
01-05 13:49:50.497: V/JS(9210): If your notification has data (key: value) pairs, they will be listed here:
01-05 13:49:50.498: V/JS(9210): google.sent_time: 1515152971335
01-05 13:49:50.498: V/JS(9210): foo: bar
01-05 13:49:50.498: V/JS(9210): from: 424050927453
01-05 13:49:50.498: V/JS(9210): google.message_id: 0:1515152971339391%0ce8d8740ce8d874
01-05 13:49:50.498: V/JS(9210): collapse_key: org.nativescript.ppTest
I am using the demo app from this repo and an Android 7.1.1 (API 25) device to test.
The notification is being constructed in the tray, but the data is not being received in the intent.
However, in onMessageReceived callback function I am getting the stringified data and the respective notification values.
This is what I am using to receive the intent in app.ts file
Activity
lini commentedon Jan 4, 2018
You should use the application's resume event instead of launch to handle the received notification. Take a look at the demo app's code for the push plugin on how exactly to extract the data from the intent:
push-plugin/demo/app/app.ts
Line 13 in 84aa277
jogboms commentedon Jan 4, 2018
@reytum do you currently have any
launchModeconfiguration in your manifest?reytum commentedon Jan 4, 2018
@jogboms I dont have any launch mode configured in Manifest, if you are referring to NativeScriptActivity.
@lini I have tried the similar configuration in app.ts file as mentioned in the original question. But still getting the data as empty.
lini commentedon Jan 5, 2018
Please give us a sample of the notification payload you use. For example, I am testing with the following:
I am seeing both the notification details (My title/My text) in the notification tray and when I tap on the notification and open the app, I am seeing the data there as well:
I am using the demo app from this repo and an Android 7.1.1 (API 25) device to test.
reytum commentedon Jan 10, 2018
@lini @jogboms Well we are using GCM's Message Builder to construct the payload in the backend. This is what we are receiving on the device side:
The notification is being constructed in the tray, but the data is not being received in the intent.
However, in onMessageReceived callback function I am getting the stringified data and the respective notification values.
This is what I am using to receive the intent in app.ts file
reytum commentedon Feb 1, 2018
@lini @jogboms Any update on this?