Java Code Examples for de.blinkt.openvpn.core.VpnStatus#addStateListener()

The following examples show how to use de.blinkt.openvpn.core.VpnStatus#addStateListener() . 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: EipSetupObserver.java    From bitmask_android with GNU General Public License v3.0 6 votes vote down vote up
private void handleGatewaySetupObserverEvent(Intent event) {
    if (observedProfileFromVpnStatus != null || setupVpnProfile != null) {
        //finish last setup observation
        Log.d(TAG, "finish last gateway setup");
        finishGatewaySetup(true);
    }

    VpnProfile vpnProfile = (VpnProfile) event.getSerializableExtra(PROVIDER_PROFILE);
    if (vpnProfile == null) {
        Log.e(TAG, "Tried to setup non existing vpn profile.");
        return;
    }
    setupVpnProfile = vpnProfile;
    setupNClosestGateway.set(event.getIntExtra(Gateway.KEY_N_CLOSEST_GATEWAY, 0));
    Log.d(TAG, "bitmaskapp add state listener");
    VpnStatus.addStateListener(this);

    launchVPN(setupVpnProfile);
}
 
Example 2
Source File: VPNFragment.java    From android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    mActivity = (MainActivity) getActivity();

    mMapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.mapFragment);
    mMapFragment.getMapAsync(mMapReadyCallback);

    mScrollView.addInterceptScrollView(mMapFragment.getView());

    VpnStatus.addLogListener(this);
    VpnStatus.addStateListener(this);

    updateIPData();
}
 
Example 3
Source File: ExternalOpenVPNService.java    From android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    VpnStatus.addStateListener(this);
    mExtAppDb = new ExternalAppDatabase(this);

    Intent intent = new Intent(getBaseContext(), OpenVPNService.class);
    intent.setAction(OpenVPNService.START_SERVICE);

    bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
    mHandler.setService(this);
}
 
Example 4
Source File: VPNhtApplication.java    From android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    PRNGFixes.apply();
    Fabric.with(this, new Crashlytics());
    sThis = this;

    if (BuildConfig.DEBUG) {
        Timber.plant(new Timber.DebugTree());
    }

    VpnStatus.addStateListener(this);
}
 
Example 5
Source File: EipStatus.java    From bitmask_android with GNU General Public License v3.0 5 votes vote down vote up
public static EipStatus getInstance() {
    if (currentStatus == null) {
        currentStatus = new EipStatus();
        VpnStatus.addStateListener(currentStatus);
    }
    return currentStatus;
}
 
Example 6
Source File: VPNActivity.java    From SimpleOpenVpn-Android with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    VpnStatus.addStateListener(this);
}
 
Example 7
Source File: ConnectingDialogFragment.java    From android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    VpnStatus.addStateListener(this);
    mAttached = true;
}
 
Example 8
Source File: LogFragment.java    From bitmask_android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onStart() {
    super.onStart();
    VpnStatus.addStateListener(this);
    VpnStatus.addByteCountListener(this);
}