Sometimes programs need to know when the vpn network has been
established/disconnected, and afaik, it's not possible with the standard
android ConnectivityManager notifications. I'm suggesting something like
diff -r 37f16fd90039 src/de/schaeuffelhut/android/openvpn/DaemonEnabler.java
--- a/src/de/schaeuffelhut/android/openvpn/DaemonEnabler.java Tue Oct 12
23:46:41 2010 +0200
+++ b/src/de/schaeuffelhut/android/openvpn/DaemonEnabler.java Fri Dec 09
18:11:28 2011 +0400
@@ -21,6 +21,8 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.net.ConnectivityManager;
+import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceManager;
@@ -208,6 +210,7 @@
summary = "Connecting";
break;
case Intents.NETWORK_STATE_RECONNECTING:
+ {
String cause = intent.getStringExtra( Intents.EXTRA_NETWORK_CAUSE );
if ( cause == null )
summary = "Reconnecting";
@@ -216,7 +219,17 @@
"Reconnecting (caused by %s)",
cause
);
+
+ Intent connectivityIntent = new
Intent("de.schaeuffelhut.android.openvpn.connectivity");
+
+ Bundle extras = new Bundle();
+ extras.putBoolean(ConnectivityManager.EXTRA_NETWORK_INFO, false);
+ connectivityIntent.putExtras(extras);
+
+ mContext.sendBroadcast(connectivityIntent);
+
break;
+ }
case Intents.NETWORK_STATE_RESOLVE:
summary = "Resolve";
break;
same technique can be applied to catch the disconnect elsewhere. I didn't study
the code much to say where. I've tried to use the functions from Notifications
class, but they appear to produce infinite amount of broadcasts.
Original issue reported on code.google.com by volkov.r...@gmail.com on 9 Dec 2011 at 2:17
Original issue reported on code.google.com by
volkov.r...@gmail.com
on 9 Dec 2011 at 2:17