So far:
I found the following solutions
Using Broadcastreceiver
The broadcast receiver is deprecated from ICS
Using Ping or Traceroute
It's definitely going to take lots of time and its not efficient
Polling for DNS server changes
It's definitely going to take lots of time and its not efficient
Using ip-address
Even though it won't take much time depending on the network connection it may vary
My conclusion:
So far all the solutions I found are either not efficient or not so reliable.
My questions:
If VPN is connected in android device then android OS must be aware of it.
Are there any public android framework APIs to read it because finding it locally is most efficient and reliable solution ?
Are there any other efficient and reliable ways to achieve it (like integrating a C or C plus plus library with NDK)?
Note:
I couldn't find any custom broadcast senders/AIDL from OpenVPN for Android as well
A Virtual Private Network (VPN) is used to establish an encrypted connection over a less secure network. VPN ensures the appropriate level of security to the connected systems when the underlying network infrastructure alone cannot provide it.
You can run the command "vpncli.exe" from the command prompt, this will tell you whether the VPN is connected or disconnected. Cisco AnyConnect Secure Mobility Client (version 4.7.
To test the connection from AWS to your on-premises network, you can use SSH or RDP to connect to your instance from your network. You can then run the ping command with the private IP address of another computer in your network, to verify that both sides of the connection can initiate and receive requests.
Have you used - VpnService
As per documentation -
Prepare to establish a VPN connection. This method returns 'null' if the VPN application
is 'already prepared'.
From here-
http://developer.android.com/reference/android/net/VpnService.html#prepare(android.content.Context)
Intent intent = VpnService.prepare(getApplicationContext());
if (intent == null) {
// this means there is already a prepared VPN connection
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With