title: Programmatically setting up a vpn on Android
body: <p>I have found the following code to establish a new vpn programmatically but I do not know how to use it to create my app</p>
  
  <pre><code>VpnService service = context.getSystemService(VPN_SERVICE);
  VpnProfile profile = VpnProfile.create(L2TP_PROFILE);
  profile.setName(myServerName);
  profile.setServerName(myServerAddress);
  profile.setRouteList("192.168.1.0/255.255.255.0,192.168.10.0/255.255.255.0");
  service.connect(profile, "myUserName", "myPassword");
  service.setNotificationIntent(myIntent);
  </code></pre>
  
  <p>can anyone please help me with a sample code?
  Is it even possible to to achieve dis?</p>