Set a VPN connection programmatically on android 4.0
Basically the VPN API introduced in Android 4.0+ only allows you to implement your own VPN implementation. It does no more than opening the Linux TUN device and pass the file descriptor to you, plus setting up the routes/DNS servers/etc you provided. The whole VPN protocol implementation is solely up to you.
So the short answer is: no. you can't use the VPN API to set up any of the
PPTP, L2TP, L2TP/IPSec PSK or L2TP/IPSec CRT
VPN connections, unless you roll out your own implementation of the mentioned VPN types.
That being said, you may still try to broadcast an Intent to bring your user to the system VPN settings activity and ask them to manually configure/start the VPN.
Oh and one more thing to add. At the time of this writing, Android's latest DevicePolicyManager (API level 21) already provides WiFi settings provisioning support. I would personally guess that Google might continue to add more Android for Work features, which may include VPN provisioning support you need. I/O 2015 is only a few days away so let's wait and see...
VpnService Android 4.0
The VPNService API is not for configuring the system VPN Services but for implementing your own VPN solution. You can for example implement protocols that are not implemented by the system like OpenVPN.
To use pptp with the VPNService API you need to implement the PPTP protocol yourself (or port an existing implementation (should not be difficult))
Related Topics
Garbage Collection Causes:Mediaplayer Finalized Without Being Released
Android Access to Remote SQL Database
Android - Way to Appear Bordered Text on the Textview
How to Switch Automatically Between Viewpager Pages
Set Language to French in Android Datepickerdialog
Android Studio Where to Install Ndk File? (Downloaded It in Zip)
How to Raise a Toast in Asynctask, I am Prompted to Used the Looper
How to Prevent Multiple Toast Overlaps
Get Last Inserted Value from SQLite Database Android
Android Mediaplayer/Videoview Error (1, -2147483648)
Converting Preview Frame to Bitmap
How to Use Sharedpreferences to Save More Than One Values
How to Send Hashmap Value to Another Activity Using an Intent
Android - Nestedscrollview Which Contains Expandablelistview Doesn't Scroll When Expanded