Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating Android vpn profile

Tags:

android

I want to Programmatically create vpn profile; somehow i figure out how to access android.net.vpnmanager and android.net.vpn.vpnprofile (they are not part of offical API and are part of hide APIs) but they have no function create new vpn profile. any suggestions?

like image 717
Duke Programmer Avatar asked Jan 17 '23 09:01

Duke Programmer


1 Answers

Using Hidden APIs is not a good idea as there is no guarantee that with an update they will still work as intended, moreover there is no guarantee that they will work in a consistent manner across different devices manufactured by different vendors.

Android 4.0 ICS has a VPN client API but again it allows you to create your own VPN client. The only reason I can think of as to why you cannot access VPN settings just as you will access wifi settings is the inherent nature of VPN connections. Here is a link to the VPN features in ICS4.0. The first part of the document discuss these risks. You can still write your own client for your app.

http://developer.android.com/reference/android/net/VpnService.html

Another approach can be to use a third party VPN client and check if you can pass any actions to it via an intent. My recommendation if you are targeting ICS only will be to go with the client API as that you know how your code is working.

like image 64
Orlymee Avatar answered Jan 29 '23 13:01

Orlymee