Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable vpn on app close #45

Open
tegozen opened this issue Jan 29, 2023 · 0 comments
Open

disable vpn on app close #45

tegozen opened this issue Jan 29, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@tegozen
Copy link

tegozen commented Jan 29, 2023

I noticed that there is no such possibility for android, although it is for ios.
I did it myself like this project/android/app/src/main/java/com/yourapp/MainActivity.java

import android.content.ComponentName;
import android.content.Intent;

public class MainActivity extends ReactActivity {
    @Override
    protected  void onDestroy(){
        try {
            Intent intent = new Intent();
            intent.setComponent(new ComponentName(this, "de.blinkt.openvpn.core.OpenVPNService"));
            intent.setAction("de.blinkt.openvpn.DISCONNECT_VPN");
            startService(intent);
        } catch(Exception err){

        }
        super.onDestroy();
    }
}

@tegozen tegozen added the enhancement New feature or request label Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant