Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to revoke VPN rights on Android on purpose?

Tags:

android

vpn

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)

like image 377
Marcel Fyrgon Marciš Avatar asked Nov 10 '22 04:11

Marcel Fyrgon Marciš


1 Answers

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

like image 194
Shayan_Aryan Avatar answered Nov 15 '22 05:11

Shayan_Aryan