Sunday 15 February 2015

android - Uninstalling app doesn't trigger onDestroy in service -



android - Uninstalling app doesn't trigger onDestroy in service -

i'm developing android service. when service stopped, ondestroy called expected. however, when uninstall app while service running, ondestroy not called, leaving app no chance clean-up itself.

is normal? how can perform shutdown/cleanup logic service when app uninstalled?

you cannot guarantee ondestroy called in cases.

when android app stopped system, app not shut downwards gracefully. instead much simpler kill process running in - shutting downwards dalvik instance right away. optimisation made possible sandboxing of placing separate apps in own runtime instances.

that why ondestroy not called - app stopped dead in tracks.

in addition, mentioned in jim's explanation, apps cannot notified of own uninstallation.

android android-service uninstall

No comments:

Post a Comment