Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Action to open up VPN Settings Activity

Tags:

android

vpn

I have been looking around for a way to launch the VPN settings activity through my android app, but cannot find it. Note that I am targeting Android 2.2, hence will not be able to use the facilities provided in android ICS.

What is the action that I should pass into an Intent in order to get the VPN settings screen to open up ?

like image 958
Heshan Perera Avatar asked May 24 '12 04:05

Heshan Perera


2 Answers

I think this is what you are looking for:

Intent intent = new Intent("android.net.vpn.SETTINGS");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
like image 67
aplik Avatar answered Sep 27 '22 21:09

aplik


try this:

    private static final String PACKAGE_PREFIX =
            VpnManager.class.getPackage().getName() + ".";
    private static final String ACTION_VPN_SETTINGS =
            PACKAGE_PREFIX + "SETTINGS";
    Intent intent = new Intent(ACTION_VPN_SETTINGS);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mContext.startActivity(intent);
like image 26
ρяσѕρєя K Avatar answered Sep 27 '22 23:09

ρяσѕρєя K