handle remote notification payloads (#737)
* handle remote notification payloads * handle intent extras for background notifications
This commit is contained in:
parent
6e6ed07890
commit
42cf11358e
4 changed files with 96 additions and 12 deletions
src/main/java/io/lbry/browser
|
@ -534,6 +534,17 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
|||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
|
||||
notificationManager.cancel(sourceNotificationId);
|
||||
}
|
||||
|
||||
// check for target (notification payload)
|
||||
String target = intent.getStringExtra("target");
|
||||
if (target != null && target.trim().length() > 0) {
|
||||
ReactContext reactContext = mReactInstanceManager.getCurrentReactContext();
|
||||
if (reactContext != null) {
|
||||
WritableMap params = Arguments.createMap();
|
||||
params.putString("url", target);
|
||||
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("onNotificationTargetLaunch", params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.onNewIntent(intent);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue