Can code be called when my Android application is uninstalled?
Unfortunately there is currently no way for an Android package to execute code when it is removed. However, you can register a BroadcastReceiver
for ACTION_PACKAGE_REMOVED
in a different package that will be called when packages are removed from the phone.
Also see this question.