When downloading and installing my app from the Play Store, I have the following issue:
After I start the app for the first time I get into my LoginActivity (which has intent-filters MAIN and LAUNCHER), I log in and then start my MainActivity, that has a HomeFragment with a green button. On Button press I hide the green button and show an orange button. If I now press the 'Home' Button, the Device goes to the home screen, then animates to a page where there is space for a new app icon and adds the icon of my app, animated (since it was a fresh download). If I now click on the icon to re-open my app, I get back to my MainActivity and HomeFragment, however the UI seems to be the way as if the Fragment was just created (green button is visible, orange is hidden). If I then press the back button, the Screen seems to close, behind it appears my "old state" MainActivity/HomeFragment, but then the UI quickly changes back to the green button, if I then press the back button again, I leave the app as expected. If I kill the app and restart, this issue no longer occurs, instead the the behaviour is as expected (when pressing home button and reopening the app, the UI is exactly how i left it).
This issue does occurs on my Nexus 5, Android 6.0.1. When going through the same steps described above on a Genymotion Virtual device (Galaxy S3, Android 4.4.1 with play services installed) I do not have the issue, the app is behaving correctly.
This issue never occurs, when I deploy from Android Studio.
Any ideas? what the issue could be?
I have added android:launchMode="singleTop"
to my MainActivity in manifest, without success.
Obviously the is also hard to debug, since it does not occur when I deploy from Android Studio (even if I uninstall the app first), so I have to submit an update to Play Store first to see results of changes.