diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/java/src/WifiListenerReceiver.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/app/java/src/WifiListenerReceiver.java b/app/java/src/WifiListenerReceiver.java index e8ebedf..ca22965 100644 --- a/app/java/src/WifiListenerReceiver.java +++ b/app/java/src/WifiListenerReceiver.java @@ -11,6 +11,7 @@ import android.net.wifi.WifiManager; import android.net.wifi.WifiInfo; import android.os.Bundle; +import android.os.Handler; import android.util.Log; @@ -23,12 +24,18 @@ public class WifiListenerReceiver extends BroadcastReceiver // start if (networkInfo.getState().equals(NetworkInfo.State.CONNECTED)) { - WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); - WifiInfo wifiInfo = wifiManager.getConnectionInfo(); - - // if (wifiInfo.getSSID() == setting.get(LOCAL_HOME_WIFI_SSID)) - - context.startService(dnsProxyService.setAction(DNSProxyService.ACTION_START)); + // wait a few moments for wifi to be fully there + (new Handler()).postDelayed(new Runnable() { + @Override + public void run() { + WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); + WifiInfo wifiInfo = wifiManager.getConnectionInfo(); + + // if (wifiInfo.getSSID() == setting.get(LOCAL_HOME_WIFI_SSID)) + + context.startService(dnsProxyService.setAction(DNSProxyService.ACTION_START)); + } + }, 1000); } // stop |