0

App has PIN lock activity thats is opened over current activity. Purpose of this activity is to prevent unauthenticated users from using the app. I keep this activity separately from main activity stack. My problem is, when user closes app while PINUnlockActivity is still visible, then relaunches app by clicking launcher icon, or by selecting it from recent apps PINUnlockActivity gets destroyed. Below is my code, that starts PINUnlockActivity. What is the correct way to handle two parallel activity stacks in my scenario?

How system decides which activity stack to show on app resume?

val intent = Intent(App.instance, PinActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS or Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
AppContext.startActivity(intent)
Rafael
  • 6,091
  • 5
  • 54
  • 79
  • Probably due to `Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS` flag – ρяσѕρєя K Jul 08 '19 at 05:50
  • I've already tried that, and it didn't help – Rafael Jul 08 '19 at 05:54
  • 1
    Remove `FLAG_ACTIVITY_CLEAR_TOP` and make this Activity's launch mode as `Singletask`. This may not work, Read [This](https://stackoverflow.com/questions/19545889/app-restarts-rather-than-resumes) first .. – ADM Jul 08 '19 at 06:28
  • you should make the activity in the single instance for this task which doesn't allow any other activity and it will be always at the top of the task – Harsh Shah Jul 08 '19 at 06:34
  • Maybe its because my launcher activity - MainActivity has this `launchMode="android:launchMode="singleTask"` ? – Rafael Jul 08 '19 at 12:10

0 Answers0