I want my android app that establishes VPN to behave well. For app to operate, user have to bestow VPN rights to my app so it can reroute all the traffic on android device. If user restarts the device he have to accept the rights again.
What I want to do it to mimic the restart behavior in case that the app is uninstalled as right now if the rights are granted, app is uninstalled and (later without restart) installed again the rights are inherited from before and I would like to ask user again.
I'm using this command to prepare VPN
startActivityForResult(VpnService.prepare(context), VPN_CONNECTION_REQUEST);
I have overridden onRevoke() method to watch for the case that user manually revokes the VPN rights.
What I miss and what I don't know how to do is to revoke those VPN rights on purpose (when app runs for the first time so when set up is done, the VPN rights confirmation dialog could be shown even if the app was uninstalled with rights bestowed upon it before)
You can go to phone settings, search for VPN, and you'll find a list that contains all apps that have granted VPN priviledge. Then click on your app, and click forget VPN. This will revoke the priviledge. Also if another VPN app grants this priviledge, this will revoke yours.
https://developer.android.com/reference/android/net/VpnService
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With