简体   繁体   中英

Relaunch app from intent

I would like to put a notification with an intent. My intent is basically action = DEFAULT and category = LAUNCHER in order to bring the activity that was launched into the front. When the app is not shown, there is no problem, the intent works perfectly and launches the last activity seen but when there is already an activity launched, onNewIntent is not called (activity is in singleTop mode).

I'm wondering how to relaunch the app from an intent to the last activity seen and call onNewIntent when the activity is already launched.

the problem is that your activity is defined as

 android:launchMode="singleTop"

when there is already an activity launched, onNewIntent is not called

implement the onDestroy method::

@Override
public void onDestroy(){
    super.onDestroy();
}

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