hallo,
kann ich den Status der vpn Verbindung abfragen um davon weitere flows ausführen zu lassen ?
status vpn verbunden abfragen ?
Moderator: Martin
- schuster666
- Posts: 52
- Joined: 13 Nov 2013 14:03
- Location: Germany / Neuss
Re: status vpn verbunden abfragen ?
Ich würde mich da anschließen wollen.
Durch ein Datenleck (bei Win10) bin ich auf dieses Thema aufmerksam geworden und würde gerne checken ob das VPN (Android) in Betrieb ist oder nicht.
Könnte man alternativ abfragen welche Symbole in der Statusleiste angezeigt werden?
Durch ein Datenleck (bei Win10) bin ich auf dieses Thema aufmerksam geworden und würde gerne checken ob das VPN (Android) in Betrieb ist oder nicht.
Könnte man alternativ abfragen welche Symbole in der Statusleiste angezeigt werden?
-- the world would be better without people--
-- but boring --
-- but boring --
Re: status vpn verbunden abfragen ?
It seems somehow I missed this post from 2018. Maybe because translation failed at that time.
You can detect the network config and check if tunneling interface is in use. use action execute command
If the stdout show something, then tunneling is in use, VPN is connected. But if blank, then no VPN connected. Check it using expression
If true, then stdout not blank, VPN Connected. If false, stdout is empty, tunneling interface not detected, VPN is not connected.
You can detect the network config and check if tunneling interface is in use. use action execute command
Code: Select all
ifconfig | grep tun
Code: Select all
std != '""
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: status vpn verbunden abfragen ?
anuraag wrote: ↑13 Apr 2019 08:38Below code works on my oreo. vpnconnected will return true or falseCode: Select all
ctx=getContext(); cm=callJavaMethod(ctx, "android.content.Context", "getSystemService(java.lang.String)", "connectivity"); vpnconnected=callJavaMethod(callJavaMethod(cm, "android.net.ConnectivityManager", "getNetworkInfo(int)", getJavaStaticField("android.net.ConnectivityManager", "TYPE_VPN")), "android.net.NetworkInfo", "isConnectedOrConnecting()");
Re: status vpn verbunden abfragen ?
Thank you for both approaches Desmanto and anuraag.
But in my tests the java way is much faster than the execute command action:
java: about 5 ms
execute command: about 100 ms
But in my tests the java way is much faster than the execute command action:
java: about 5 ms
execute command: about 100 ms
Re: status vpn verbunden abfragen ?
@anuraag : Thank you always for the java code. I wish i really spent my time to learn java properly.
@Horschte : Thanks for the testing. So in most cases, when speed is important, calling java method is always preferred than using terminal emulator command. But this seems only happen in Automagic, as maybe for the action execute command (and root command), Automagic need to setup the environment first before executing the command. While script is already built-in.
@Horschte : Thanks for the testing. So in most cases, when speed is important, calling java method is always preferred than using terminal emulator command. But this seems only happen in Automagic, as maybe for the action execute command (and root command), Automagic need to setup the environment first before executing the command. While script is already built-in.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
- schuster666
- Posts: 52
- Joined: 13 Nov 2013 14:03
- Location: Germany / Neuss
Re: status vpn verbunden abfragen ?
Thank you all.
With this script/code all of my flows working perfekt.
Coding Java is next on my todo List.
I'm always very impressed about the possibilitys.
In hope that my mind will do the trick…..
With this script/code all of my flows working perfekt.
Coding Java is next on my todo List.
I'm always very impressed about the possibilitys.
In hope that my mind will do the trick…..
-- the world would be better without people--
-- but boring --
-- but boring --