I have an Activity
with launch mode singleTop
which shows permission dialog.
But when permission dialog is present and a new Intent comes for that activity , another instance is created .
onNewIntent()
doesn't get called.
Any workaround for this?
Below is the manifest entry.
<activity
android:name=".auth.activity.AJRAuthActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.PageIndicatorDefaults"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize" />
The way I start this activity:
Intent loginIntent = new Intent(context, AJRAuthActivity.class);
context.startActivity(loginIntent);
Showing the permission dialog usually starts another Activity
(a system Activity
) on top of your Activity
. In this case, your Activity
will be paused (onPause()
is called). At that point, your Activity
is no longer the top Activity
on the stack, so that another launch of the Activity
will create another instance, even if "singleTop" launch mode and/or Intent.FLAG_ACTIVITY_SINGLE_TOP
is specified.
See Request permission dialog pauses my activity
To get around this, you should ensure that you have all the permissions that you might need as early as possible, or rearchitect your application so that you don't have the problem of multiple instances.