diff options
author | Arne Schwabe <arne@rfc2549.org> | 2013-04-06 19:46:07 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2013-04-06 19:46:07 +0200 |
commit | bde3a3f780cc668619076df96147b76be1c4ab64 (patch) | |
tree | 0c47b7894df388844ef3b9a806711b704c227b3d /src/de/blinkt/openvpn/api/GrantPermissionsActivity.java | |
parent | ad2256b6fe9c211d06321d99590cb457427d8e7d (diff) |
Add external API with security.
Diffstat (limited to 'src/de/blinkt/openvpn/api/GrantPermissionsActivity.java')
-rw-r--r-- | src/de/blinkt/openvpn/api/GrantPermissionsActivity.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/de/blinkt/openvpn/api/GrantPermissionsActivity.java b/src/de/blinkt/openvpn/api/GrantPermissionsActivity.java new file mode 100644 index 00000000..659ec24b --- /dev/null +++ b/src/de/blinkt/openvpn/api/GrantPermissionsActivity.java @@ -0,0 +1,26 @@ +package de.blinkt.openvpn.api; + +import android.app.Activity; +import android.content.Intent; +import android.net.VpnService; + +public class GrantPermissionsActivity extends Activity { + private static final int VPN_PREPARE = 0; + + @Override + protected void onStart() { + super.onStart(); + Intent i= VpnService.prepare(this); + if(i==null) + onActivityResult(VPN_PREPARE, RESULT_OK, null); + else + startActivityForResult(i, VPN_PREPARE); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + setResult(resultCode); + finish(); + } +} |