I use android 10 [android Q, galaxy 10],
I use android studio 3.3,
using AVD, and made a api 29 [android 10] virtual phone.
at the virtual machine, I execute my app , after that, I launch other app like calendar, calculator. so my app activity get into background mode.
when I receive a message at BroadcastReceiver. I call startActivity.
here, code --> public class myReceiver extends BroadcastReceiver {}
public void onReceive(Context context, Intent intent)
{
Intent intentRun = new Intent(context, LoginSuccess.class);
intentRun.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TASK);
context.startActivity(intentRun);
}
but LoginSuccess activity do not shows up. [when my app is in background mode]
using same code, LoginSuccess activity show up very well when my app is in foreground mode.
above image shows call stack right before I call startActivity in broadcast receiver.
I have read guide line for android 10 background activity issue. [developer.android.com/~~ some location]
at the guide line,
I came to know that if the activity exists in call stack, it can be started even in background mode.
above code, it try to start activity that exists in recent call stack.
why startActivity call fail in background mode ? [maybe not fail , but anyway not activated into foreground]