can i write to sql database while android mobile getting switched off
I need to store some data while the device is shutting down, so that i could use those values after reboot.
Can i use android.intent.action.ACTION_SHUT开发者_运维技巧DOWN
-intent to fullfill my requirement?
I need to store some data while the device is shutting down, so that i could use those values after reboot.
No, you need to store the data when it changes.
Devices do not always shut down cleanly (e.g., battery pops out). Also, the user can terminate your application without warning using a task killer or the Settings application. Please save the data as you go, when it changes, so you do not lose data in these cases. As a side benefit, you will no longer care about the ACTION_SHUTDOWN
event.
精彩评论