handle remote notification payloads ()

* handle remote notification payloads
* handle intent extras for background notifications
This commit is contained in:
Akinwale Ariwodola 2019-10-30 10:34:57 +01:00 committed by GitHub
parent 6e6ed07890
commit 42cf11358e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 96 additions and 12 deletions
src/main/java/io/lbry/browser

View file

@ -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);