Page 1 of 1

problems when reconnect user

Posted: Fri May 24, 2019 9:52 am
by dod
Hello, I'm trying to launch the open vpn application with a profile already created by me.
I have the problem that when I want to automatically reconnect the application to that profile, it tries but does not reconnect with it.
My app it´s a launch, who launcha the open vpn with this code:

Code: Select all

  public void lanzarVpn(){
        String profile = "alfa";
        Intent openVPN = new Intent("android.intent.action.VIEW");
        openVPN.setClassName("net.openvpn.openvpn", "net.openvpn.unified.MainActivity");
        openVPN.putExtra("net.openvpn.openvpn.AUTOSTART_PROFILE_NAME", "PC "+profile);
        openVPN.putExtra("net.openvpn.openvpn.AUTOCONNECT", true);
        openVPN.putExtra("net.openvpn.openvpn.APP_SECTION", "PC");
        startActivity(openVPN);
}
that work the first time well, but if i launch my app again the profile not reconnect automatically. I´ll have to click the profile in open vpn.

For close the conexion i use this:

Code: Select all

public  void  cerrarConexion() {
            String profile = "alfa";
            Intent cerrarVPN = new Intent("net.openvpn.openvpn.DISCONNECT");
        cerrarVPN.setClassName("net.openvpn.openvpn", "net.openvpn.unified.MainActivity");
         cerrarVPN.putExtra("net.openvpn.openvpn.DISCONNECT", true);
            cerrarVPN.putExtra("net.openvpn.openvpn.STOP", "PC "+profile);
            cerrarVPN.putExtra("net.openvpn.openvpn.STOP", true); 
            startActivity(cerrarVPN);
}

Is there any way to close the application from my own application? or be able to kill the service

Or how can I reconnect automatically well?

Any suggestions?

Then i try to compile this code:
for modify the app, but i try to open with android studio and can´t open to do work.
The code fail, said me that errors:

Code: Select all

CreateProcess error=2, The system can not find the specified file
And the run task:

Code: Select all

OException: Cannot run program "swig" (in directory "C:\Users\ser\Downloads\ics-openvpn-master\main"): CreateProcess error=2, El sistema no puede encontrar el archivo especificado
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)