CLEAR DATA when a home screen widget is active?
I have a Home Screen widget that stores both some cached data and some shared preferences in the package's private data directory.
I can handle the loss of the data cleanly when the user "CLEAR DATA" option is selected, but I have important shared preferences that get trashed also. (There can be multiple instances of the widget, etc.) The point is that a normal App won't be running when the CLEAR DATA is performed and so the App can recover next time it is launched, but the widget has no way to recover or even know that the preferences have been trashed.
Does any one have any suggestions how to make my preferences truly 开发者_运维知识库persistent for the lifetime of the widget on the Home Screen?
It is irritating that this behaviour of the CLEAR DATA button was added some time after the developer documentation was written and it directly contradicts the documentation. Who updates the documentation? Why has this been left as a lie to confuse developers for so long?
精彩评论