Issue
I need to bring the app from background to foreground when push notifications arrives. This code works fine on versions prior to 11.
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
...
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);
...
}
But stops working in android 11. Any idea? Thanks!!
Solution
Posting comment as answer:
AFAIK, Its not possible to start activities from the background since Android 10 unless your app meets one of the specific exceptions, see here. Are you sure your app was in the background? Also Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
should have nothing to do with actually starting the activity, it just moves to it the front of the stack if it is already running.
Answered By - free_coupons_for_sale_1023
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.