diff options
author | Arne Schwabe <arne@rfc2549.org> | 2013-03-11 23:12:58 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2013-03-11 23:12:58 +0100 |
commit | 787c024cb5b1401e20fb11e876a74973208c2c55 (patch) | |
tree | 04a8a737601369e75490834904f6fd2b89645829 /src/de/blinkt/openvpn/OpenVpnService.java | |
parent | 5b21477afa29b82ccbd98ae2bbb46053a12a703f (diff) |
Add broadcast sent when VPN Status changes, still needs to tested (closes issue #150)
Diffstat (limited to 'src/de/blinkt/openvpn/OpenVpnService.java')
-rw-r--r-- | src/de/blinkt/openvpn/OpenVpnService.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java index e580089f..9f6da4c3 100644 --- a/src/de/blinkt/openvpn/OpenVpnService.java +++ b/src/de/blinkt/openvpn/OpenVpnService.java @@ -20,6 +20,7 @@ import java.lang.reflect.Method; import java.util.Locale; import java.util.Vector; +import android.Manifest.permission; import android.annotation.TargetApi; import android.app.Notification; import android.app.NotificationManager; @@ -542,6 +543,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac public void updateState(String state,String logmessage, int resid, ConnectionStatus level) { // If the process is not running, ignore any state, // Notification should be invisible in this state + doSendBroadcast(state, level); if(mProcessThread==null && !mNotificationalwaysVisible) return; @@ -564,6 +566,14 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac } } + private void doSendBroadcast(String state, ConnectionStatus level) { + Intent vpnstatus = new Intent(); + vpnstatus.setAction("de.blinkt.openvpn.VPN_STATUS"); + vpnstatus.putExtra("status", level.toString()); + vpnstatus.putExtra("detailstatus", state); + sendBroadcast(vpnstatus, permission.ACCESS_NETWORK_STATE); + } + @Override public void updateByteCount(long in, long out, long diffin, long diffout) { if(mDisplayBytecount) { |