"Clear User Data" android
What exactly does Clear User Data do? I mean I know it clears the users data from the app, but what dat开发者_运维技巧a being stored where?
This is not a permissions that applications can hold.
It is there for the settings app's "Clear data" button in manage applications. It simply erases all of the data in internal storage associated with the app, bringing it back to its initial install state.
This "CLEAR DATA" option is severely broken for the use-case of Home Screen widgets that may have shared preferences and/or some local cached data.
It is also completely against the developer documentation which says:
"You can save files directly on the device's internal storage. By default, files saved to the internal storage are private to your application and other applications cannot access them (nor can the user). When the user uninstalls your application, these files are removed."
It would be good if answers to valid questions actually offered some useful advice, like a work-around or some method that achieves the result being sought by the question.
So, what happens to a Home Screen widget that has shared preferences and then the user clears the data? Any useful suggestion how not to break the running code of the widget when it has the data pulled away without any notice?
精彩评论