theappbusiness / android-proxy-toggle

Small application to help android developers to quickly enable and disable proxy settings
MIT License
425 stars 59 forks source link

Add uninstall script #14

Closed fmontesino closed 4 years ago

fmontesino commented 4 years ago

Why?

As we're modifying the device's global settings, whenever we uninstall the app we will leave the device in the last used state. That means the possibility of having the device permanently proxied.

What?

Added a small script to uninstall the app and make sure we reset the proxy setting.

Bonus

Tidied up the README file with a new caveat section

codecov-commenter commented 4 years ago

Codecov Report

Merging #14 into main will not change coverage. The diff coverage is n/a.

@@            Coverage Diff            @@
##               main      #14   +/-   ##
=========================================
  Coverage     40.11%   40.11%           
  Complexity       35       35           
=========================================
  Files            16       16           
  Lines           172      172           
  Branches         14       14           
=========================================
  Hits             69       69           
  Misses          102      102           
  Partials          1        1           
geftimov commented 4 years ago

Is there a callback in the App lifecycle to detect deletion so we can run those commands from the app itself?

fmontesino commented 4 years ago

Is there a callback in the App lifecycle to detect deletion so we can run those commands from the app itself?

AFAIK no, there's no control whenever the app is uninstalled. You can receive a broadcast notification whenever other apps uninstall, but not yours :( https://stackoverflow.com/questions/5132472/can-code-be-called-when-my-android-application-is-uninstalled https://developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_REMOVED

The package that is being removed does not receive this Intent.

There's this very convoluted app but I think it's not worth enough: https://stackoverflow.com/questions/18692571/how-can-an-app-detect-that-its-going-to-be-uninstalled/18816716#18816716