Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Jellybean 4.2 have Intent to connect to an already-defined VPN?

(revised... now I'm running JB, and still have the same problem that I did more than a year ago)

I have Jellybean (4.2) installed on my Xoom & Galaxy S3 (CM10.1), and I'm trying to write a Tasker plug-in to automatically connect to a PPTP or L2TP VPN whenever a wi-fi connection becomes active.

Unlike previous versions of Android, ICS finally allows VPNs to be defined with saved username & password, so it looks like basically everything is in place to support a new public Intent that means, "Attempt connection to ${vpn}". However, if such an intent exists, I haven't found any documentation for it. Can someone please point me in the right direction? (package name, magic phrase to search for, etc)?

like image 533
Bitbang3r Avatar asked Jan 24 '12 15:01

Bitbang3r


1 Answers

Are you referencing Always-On VPN? It doesn't work with intents at least not intents generated from apps. It uses vpn profiles. When a vpn profile is created in the Settings app. It can be set as always on. The ConnectivityManager will then automatically launch the vpn connection described by the profile when a network connection is established. The connectivity manager explicitly checks for the presence of credentials in the keystore with the key LOCKDOWN_VPN. If they are present it will load the profile. The only intents that are used are in the initializing of the LockdownVPn instance. It registers a receiver and upon receipt an intent, which is a system broadcast if I remember correctly, the receiver is then unregistered once the intent has been received. You would have to look in the source for the ConnectivityManager and Vpn and LockdownVpn for more details. Also PPTP doesn't work with always-on. PPTP profiles are explicitly filtered out when adding a profile as an Always-On Vpn Profile. L2TP and IPSEC work though.

Hope that helps.

like image 192
dudebrobro Avatar answered Sep 28 '22 05:09

dudebrobro