On Mon, May 28, 2012 at 4:56 PM, Yan <[email protected]> wrote:
> Thanks for the idea "to pull out the battery" notification! You
> guessed right about the category of "people treating Android like
> Linux". Which begs the question of what system call would you use if
> your app's data got corrupted and the final() call could not handle
> it. Would you consider it permissible to kill your own process?

No.

In the beginning, the device does not have your app. Then, the user
installs your app. Then, the user runs your app for the first time.

At this moment, your app has no data on persistent storage (e.g.,
databases). Hence, your app needs to handle the first-run scenario
where your app has no data on persistent storage -- otherwise, your
app can never run successfully, and this is all a moot point.

Similarly, at this moment, your app has no data in memory (e.g.,
static data members). Hence, your app needs to handle the first-run
scenario where your app has no data in memory -- otherwise, your app
can never run successfully, and this is all a moot point.

If, during the operation of your app, you determine that your data is
irreversibly corrupted, you wipe the data in persistent storage, null
out the static data members, and start over, along with launching an
activity with FLAG_ACTIVITY_CLEAR_TOP + FLAG_ACTIVITY_SINGLE_TOP to
let the user know that you had to wipe out their data. You do not need
to terminate your process to achieve any of this.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to