• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How to configure VPN programatically ?

n0sferat0k

Lurker
Apr 25, 2012
1
0
I need to implement an android app that would allow the user to configure a VPN connection without having to access the native menu of the android device. With this i have two problems:

1. in android 4.0 + (api level 14 and above) i have found there is a new component called VpnService which provides a hook for creating a virtual network interface, configuring it and intercepting / forwarding pachets from it to a VPN server, but there are no built in vpn protocols like PPTP or IPSec, there is just the possibility of implementing them. My question is is there any ready made solution for PPTP and IPSec to work with VpnService ?

2. In earlier versions of android, from what i have found so far, it seems the only way to use VPN is to access and configure the built in vpn solution of the device by wrapping (using reflection) some hidden apis in android but this is a cumbersome solution since the device needs to be rooted, also the hidden api implementations may differ from device to device, and from OS version to OS version. Is there a better way to programatically configure the built in VPN of the underlying linux OS ?

Thank you.
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones