Java Code Examples for de.blinkt.openvpn.core.ProfileManager#get()

The following examples show how to use de.blinkt.openvpn.core.ProfileManager#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExternalOpenVPNService.java    From android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void startProfile(String profileUUID) throws RemoteException {
    checkOpenVPNPermission();

    VpnProfile vp = ProfileManager.get(getBaseContext(), profileUUID);
    if (vp.checkProfile(getApplicationContext()) != R.string.no_error_found)
        throw new RemoteException(getString(vp.checkProfile(getApplicationContext())));

    startProfile(vp);
}
 
Example 2
Source File: ExternalOpenVPNService.java    From android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void removeProfile(String profileUUID) throws RemoteException {
    checkOpenVPNPermission();
    ProfileManager pm = ProfileManager.getInstance(getBaseContext());
    VpnProfile vp = ProfileManager.get(getBaseContext(), profileUUID);
    pm.removeProfile(ExternalOpenVPNService.this, vp);
}
 
Example 3
Source File: LaunchVPN.java    From android with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onStart() {
    super.onStart();
    // Resolve the intent

    final Intent intent = getIntent();
    final String action = intent.getAction();

    // If the intent is a request to create a shortcut, we'll do that and exit


    if (Intent.ACTION_MAIN.equals(action)) {
        // we got called to be the starting point, most likely a shortcut
        String shortcutUUID = intent.getStringExtra(EXTRA_KEY);
        String shortcutName = intent.getStringExtra(EXTRA_NAME);
        mhideLog = intent.getBooleanExtra(EXTRA_HIDELOG, false);

        VpnProfile profileToConnect = ProfileManager.get(this, shortcutUUID);
        if (shortcutName != null && profileToConnect == null)
            profileToConnect = ProfileManager.getInstance(this).getProfileByName(shortcutName);

        if (profileToConnect == null) {
            VpnStatus.logError(R.string.shortcut_profile_notfound);
            // show Log window to display error
            finish();
            return;
        }

        mSelectedProfile = profileToConnect;
        launchVPN();

    }
}