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
On Android, after receiving a push notification sent from the Firebase console/server, if the app is closed and the user taps on the notification, the apps gets opened (as expected), but the payload from the notification gets lost.
In this case, MainActivity::onCreate is able to retrieve such payload with just:
Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.v(TAG, "onCreate start, using Android Logging v1");
System.err.println("onCreate called, writing this to System.err");
+ if (getIntent().getExtras() != null) {
+ for (String key : getIntent().getExtras().keySet()) {
+ Object value = getIntent().getExtras().get(key);
+ Log.d(TAG, "Key: " + key + " Value: " + value);
+ }
+ }
...
That produces:
[Mon Oct 28 20:39:15 CET 2024][INFO] [SUB] Key: google.delivered_priority Value: high
[Mon Oct 28 20:39:15 CET 2024][INFO] [SUB]Key: google.sent_time Value: 1730144297078
[Mon Oct 28 20:39:15 CET 2024][INFO] [SUB] Key: google.ttl Value: 2419200
[Mon Oct 28 20:39:15 CET 2024][INFO] [SUB] Key: google.original_priority Value: high
[Mon Oct 28 20:39:15 CET 2024][INFO] [SUB] Key: google.product_id Value: 133506909
[Mon Oct 28 20:39:15 CET 2024][INFO] [SUB] Key: from Value: 435938649177
[Mon Oct 28 20:39:15 CET 2024][INFO] [SUB] Key: body Value: my_text
[Mon Oct 28 20:39:15 CET 2024][INFO] [SUB] Key: title Value: my_title
[Mon Oct 28 20:39:15 CET 2024][INFO] [SUB] Key: google.message_id Value: 0:1730144349038847%de0741a4de0741a4
[Mon Oct 28 20:39:15 CET 2024][INFO] [SUB] Key: gcm.n.analytics_data Value: Bundle[mParcelledData.dataSize=352]
[Mon Oct 28 20:39:15 CET 2024][INFO] [SUB] Key: collapse_key Value: com.gluonhq.pushnotes
And instead of using MainActivity, a BroadcastReceiver can be registered within the PushNotification service to get the intent and its extras, and then, by filtering the fields related to the notification from the extras, this payload can be passed down to RuntimeArgs.
The four expected fields in the payload will be the same as those four used in PushFcmMessagingService:
On Android, after receiving a push notification sent from the Firebase console/server, if the app is closed and the user taps on the notification, the apps gets opened (as expected), but the payload from the notification gets lost.
In this case,
MainActivity::onCreate
is able to retrieve such payload with just:That produces:
And instead of using MainActivity, a BroadcastReceiver can be registered within the PushNotification service to get the intent and its extras, and then, by filtering the fields related to the notification from the extras, this payload can be passed down to RuntimeArgs.
The four expected fields in the payload will be the same as those four used in PushFcmMessagingService:
The text was updated successfully, but these errors were encountered: