airbnb / DeepLinkDispatch

A simple, annotation-based library for making deep link handling better on Android
http://nerds.airbnb.com/deeplinkdispatch/
4.38k stars 405 forks source link

Links survives through app relaunch #220

Closed gurappa closed 6 years ago

gurappa commented 6 years ago

We use this lib in our app.

  1. Kill app
  2. Launch app with deep link. That opened, say, a dialog on top of activity.
  3. press back key on app and close it.
  4. Launch it again through Recent Tasks. Dialog shows up again. Repeat steps, it shows up again. I think this is because on back key, process is not dead and activity has overrides onSaveInstanceState() and onRestoreInstanceState(). I see in onCreate() that getIntent() returns the intent with same previous deep link. Hence the problem.

This does not happen if I launch app from home screen in which case it posts the launch home intent so the previous intent could have been replaced with it and so gone.

I know it is how it works in Android. But is there a way in this lib or in Android to solve it ?

gurappa commented 6 years ago

It was not an issue with Airbnb library but that is how it works with Android. When launched from recents after killing app with back key, Android posts the previous intent that was used to launch app. Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS indicates if app launched from history/recent screen. This flag can be used to handle any logic.