This is how I did it.
I marked the main activity as
<activity
android:name=".ui.MainSettingsActivity" android:label="@string/app_name" android:launchMode="singleTop" android:clearTaskOnLaunch="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and prompt for password in `onCreate` and `onNewIntent` in the Activity.java worked like a charm
This way, if the user open a new instance or use a existing from from stack history we can popup for the password.
Key part here is "singleTop".
If an instance of the activity already exists at the top of the target task, the system routes the intent to that instance through a call to its
onNewIntent()
method, rather than creating a new instance of the activity.
No comments:
Post a Comment