开发者

how to prevent the app be killed by "unmount media"(change to usb storage mode)

the app is downloading, and write the file to sdcard. then change the phone to usb storage mode, the开发者_如何学编程 app will be killed by system. because the app is using the sdcard. how to prevent this? or if there is some notification before killing ?


The android platform does show a warning that some applications may stop working if used in USB storage mode.

I don't think there is any other way for the application to handle this. The application on the next run should determine if everything went alright last time.


Don't allow the app to be moved to the sdcard so the app won't get killed. If you are writing files to the sdcard during the time the external storage is unmounted, handle the errors that occur and/or monitor the sdcard mount/unmount broadcasts.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜