Skip to content Skip to sidebar Skip to footer

App Is Not Maintaining The State After Installation - Xamarin Android

Recently I noticed one thing in my app. I created apk for my app say ABC.apk and copied to my device and installed it by clicking on it. After the installation got successfully com

Solution 1:

The problem is the way that the app gets launched from the installer doesn't exactly match the way Android launches apps from the HOME screen. Because this, if you initially launch your app from the installer, when you then later launch the app again from the HOME screen, Android doesn't recognize that the app is already running and just creates a new instance of the root Activity and adds it to the existing task on top of whatever activities are already there.

This is why, if you kill the app and start it again from the HOME screen, you won't ever see this strange behaviour.

This is a nasty Android bug which has been around since the dawn of time and is still broken, even though countless issues have been opened about it and the behaviour is reproducible and well-documented.

See the following issues and questions:

There is a workaround documented in my answer to Re-launch of Activity on Home button, but...only the first time

Solution 2:

Just some general comments that come to mind that you must consider that can cause problems.

  1. If you are trying to deploy an apk, did you switch from debug to release before building it? Make sure you are doing a full release. Do a clean and rebuild while in release mode as well.
  2. Did you sign the apk?
  3. Make sure all the necessary (if any) permissions are set in the manifest that will be needed by your app, on the device.

Hope these help point you in a direction.

Mike

Post a Comment for "App Is Not Maintaining The State After Installation - Xamarin Android"