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?
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.
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