Skip to content

Instantly share code, notes, and snippets.

@MrCrambo
Created May 5, 2020 22:22
Show Gist options
  • Save MrCrambo/835924bbbc366acd4c63d4db7843f25a to your computer and use it in GitHub Desktop.
Save MrCrambo/835924bbbc366acd4c63d4db7843f25a to your computer and use it in GitHub Desktop.
if (!mWifiScanning && timeNow > mWifiLastTime + WIFI_SLEEP_TIMEOUT)
{
if (mWifiBroadcastReceiver != null && !mWifiRegistered)
{
mContext.registerReceiver(mWifiBroadcastReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
mWifiRegistered = true;
}
if (mWifiManager.startScan())
{
mWifiTime = timeNow;
try
{
mContext.unregisterReceiver(mWifiBroadcastReceiver);
mWifiRegistered = false;
} catch (Throwable e) { }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment