@@ -61,9 +61,18 @@ public Map<String, Object> getConstants() {
61
61
return constants ;
62
62
}
63
63
64
- public void onNewIntent (Intent intent ) {
64
+ private Bundle getBundleFromIntent (Intent intent ) {
65
+ Bundle bundle = null ;
65
66
if (intent .hasExtra ("notification" )) {
66
- Bundle bundle = intent .getBundleExtra ("notification" );
67
+ bundle = intent .getBundleExtra ("notification" );
68
+ } else if (intent .hasExtra ("google.message_id" )) {
69
+ bundle = intent .getExtras ();
70
+ }
71
+ return bundle ;
72
+ }
73
+ public void onNewIntent (Intent intent ) {
74
+ Bundle bundle = this .getBundleFromIntent (intent );
75
+ if (bundle != null ) {
67
76
bundle .putBoolean ("foreground" , false );
68
77
intent .putExtra ("notification" , bundle );
69
78
mJsDelivery .notifyNotification (bundle );
@@ -155,8 +164,7 @@ public void getInitialNotification(Promise promise) {
155
164
WritableMap params = Arguments .createMap ();
156
165
Activity activity = getCurrentActivity ();
157
166
if (activity != null ) {
158
- Intent intent = activity .getIntent ();
159
- Bundle bundle = intent .getBundleExtra ("notification" );
167
+ Bundle bundle = this .getBundleFromIntent (activity .getIntent ());
160
168
if (bundle != null ) {
161
169
bundle .putBoolean ("foreground" , false );
162
170
String bundleString = mJsDelivery .convertJSON (bundle );
@@ -210,12 +218,12 @@ public void cancelLocalNotifications(ReadableMap userInfo) {
210
218
}
211
219
212
220
@ ReactMethod
213
- /**
214
- * Clear notification from the notification centre.
215
- */
216
- public void clearLocalNotification (int notificationID ) {
217
- mRNPushNotificationHelper .clearNotification (notificationID );
218
- }
221
+ /**
222
+ * Clear notification from the notification centre.
223
+ */
224
+ public void clearLocalNotification (int notificationID ) {
225
+ mRNPushNotificationHelper .clearNotification (notificationID );
226
+ }
219
227
220
228
@ ReactMethod
221
229
public void registerNotificationActions (ReadableArray actions ) {
0 commit comments