mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-17 12:19:21 +08:00
@@ -4,6 +4,7 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.RemoteInput;
|
||||
|
||||
import com.facebook.react.HeadlessJsTaskService;
|
||||
import com.facebook.react.ReactApplication;
|
||||
@@ -24,6 +25,13 @@ public class RNFirebaseBackgroundNotificationActionReceiver extends BroadcastRec
|
||||
WritableMap notificationOpenMap = Arguments.createMap();
|
||||
notificationOpenMap.putString("action", extras.getString("action"));
|
||||
notificationOpenMap.putMap("notification", notificationMap);
|
||||
|
||||
Bundle extrasBundle = extras.getBundle("results");
|
||||
if (extrasBundle != null) {
|
||||
WritableMap results = Arguments.makeNativeMap(extrasBundle);
|
||||
notificationOpenMap.putMap("results", results);
|
||||
}
|
||||
|
||||
return notificationOpenMap;
|
||||
}
|
||||
|
||||
@@ -49,6 +57,11 @@ public class RNFirebaseBackgroundNotificationActionReceiver extends BroadcastRec
|
||||
RNFirebaseBackgroundNotificationActionsService.class
|
||||
);
|
||||
serviceIntent.putExtras(intent.getExtras());
|
||||
|
||||
Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
|
||||
if (remoteInput != null) {
|
||||
serviceIntent.putExtra("results", remoteInput);
|
||||
}
|
||||
context.startService(serviceIntent);
|
||||
HeadlessJsTaskService.acquireWakeLockNow(context);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user