开发者

Programmatically start / launch VPN connection

I am developing Enterprise applications that need to connect to servers behind the firewall. Can my app start VPN connection programmatically?

On 2.0+ platforms, VPN is supported by the platform. Assuming user has already setup VPN parameters, can my app start the VPN connection? Suppose user has not setup any VPN parameters, can my app supply those parameters? and start VPN connection?开发者_Python百科


We're facing this problem at our shop. For now our best shot is trying to use Android internal API to connect to the VPN the same way that the system preferences app does.

First, you need to set up an environment that allows you to access internal API: http://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/

Then we can implement something like this http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.4.4_r1/com/android/settings/vpn2/VpnSettings.java#258

I don't know if we will have any permission issues with this, but IMHO this is the best option we have right now

EDIT: this need root privileges in order to avoid java.lang.SecurityException: Unauthorized Caller errors.


Suppose user has not setup any VPN parameters, can my app supply those parameters? and start VPN connection?

yes, I think it's possible with VpnService class as in this example

Assuming user has already setup VPN parameters, can my app start the VPN connection?

I'm looking for it also. I'm not sure, but I think maybe it can be done with android.net.vpn. See this


AnyConnect by Cisco has private API: http://www.cisco.com/c/en/us/td/docs/security/vpn_client/anyconnect/anyconnect30/administration/guide/anyconnectadmin30/acmobiledevices.html#71308


Yes you can start a VPN connection.what version of android are you using? this link should be useful . give details for better understanding.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜