Reputation: 3263
I am currently doing an update of an app in the play store. Lets assume the play store contains V1, I am now working on V2.
Now I experience some problems during the update.
Depending on the state of the device screen during installation, I either can find the saved data in the shared preferences if the screen is turned on, I cannot find the saved data if the screen is turned off.
Clarification: V1 of my app is in the play store and currently installed on my device. V1 has saved some data in the preferences. Now in Android Studio I press run, V2 gets installed on my device. If I have the device screen turned on during installation everything will work, the V2 will replace the V1 app on the device and will start and find the V1 data. If I have the device screen turned off during installation, the app will also be installed and when I turn on the screen the app will indeed start, but will not find the saved data and go on doing the wrong stuff.
Is this problem known? Is there a solution?
Upvotes: 1
Views: 70
Reputation: 3263
The mistake was with me. When the screen is turned off, Android will call onPause() right after onResume() and in onPause is where I do my saving. But the save data wasn't properly initialized du to going right into onPause(), so it saved a 0 which is wrong.
Upvotes: 1