简体   繁体   中英

What happens to the Activity lifecycle after an app update?

Suppose this scenario. You have an app where you fill a form in one activity. The activity uses onRestoreInstanceState and onSaveInstanceState to save the responses of the form. If a user is filling the form with app version 1, and then the PlayStore automatically updates and installs the app to version 2 before he finishes, what version was the form completed on?

Same question but supposing the user forces the update?

Thanks

The app update is a process involving the apk currently stored on your device and the updated apk from PlayStore. To apply the update, the system will kill your application.

Originally(before API21), the bundle containing the InstanceState was valid only if the app was opened, but after API21 you can set the persistableMode true, so your bundle will survive to process kill and will be available in your onCreate(Bundle, PersistableBundle) method as second parameter.

生命周期将与关闭和打开应用程序相同。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM