Open kenkosmowski opened 8 years ago
I've played around with the sample and here is what I get when testing on a Sony Xperia Z5:
This is the exact same behavior as I've seen described on StackOverflow, as you say yourself, the topmost Activity gets launched again when you start the app from recent apps, instead of the app re-launching from scratch.
Can we do anything about this? Probably...
I've tried to see if OnDestroy
gets hit in the Activity. However, it does not seem like it :(
I think the only alternative is to check in OnResume
when your app is re-launched and check if previously permitted permissions have been revoked. If that is the case re-launch the app on the splash screen with FLAG_ACTIVITY_CLEAR_TASK
and FLAG_ACTIVITY_NEW_TASK
flags set.
The problem with re-launching the app if permissions have been revoked: During "first" re-launch from recent apps you will always see a blank screen during Mvx initialization. Only after this initialization you can re-launch on the splash screen - it works, but doesn't look very nice.
@kenkosmowski a couple of things:
Steps to reproduce
Expected behavior
After enabling and disabling camera access, the process gets killed by the OS. Android restarts the topmost activity and displays the SplashScreen during Mvx initialization (and forces IMvxAppStart to run) OR it should restart the app entirely up from scratch. After initialization, FooService should be started and display the "Message received" dialog after tapping "Publish message".
Actual behavior
Android restarts the topmost activity and displays a blank view (not the SplashScreen) during Mvx initialization. IMvxAppStart isn't triggered and FooService isn't started, so it can't display the "Message received" dialog.
Configuration
Version: 4.2.3
Platform: Android