简体   繁体   中英

Android call onNewIntent() of homescreen launcher

I learned that the Android launcher resets the homescreen to the default page when onNewIntent() is called. I know that onNewIntent() is called when the activity receives another start intent while it's already in the foreground. Is there a way to call the onNewIntent() of the activity when it's in the background?

I have tried several flags like FLAG_ACTIVITY_CLEAR_TOP, FLAG_ACTIVITY_SINGLE_TOP and FLAG_ACTIVITY_REORDER_TO_FRONT but none seems to call onNewIntent.

Any help would be appreciated

Try this, It will Help You,

Intent intent = new Intent(MainActivity.this, TargetActivity.class);
intent.setAction(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainActivity.startActivity(intent);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM