on launch, check wifi if WIFI_STATE_ENABLED, the receiver handles the rest
On launch, we need to get the current state of the Wifi. We only need to start the WifiStateChangeService on WIFI_STATE_ENABLED, since any other wifi state will be received by WifiStateChangeReceiver, which will launch WifiStateChangeService when appropriate. This reduces the chance that WifiStateChangeService will start when it is not needed.
This commit is contained in:
parent
bdc190a7d6
commit
c1b0b854fc
@ -241,8 +241,7 @@ public class FDroidApp extends Application {
|
||||
FDroidApp.initWifiSettings();
|
||||
WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
|
||||
int wifiState = wifiManager.getWifiState();
|
||||
if (wifiState == WifiManager.WIFI_STATE_ENABLING
|
||||
|| wifiState == WifiManager.WIFI_STATE_ENABLED)
|
||||
if (wifiState == WifiManager.WIFI_STATE_ENABLED)
|
||||
startService(new Intent(this, WifiStateChangeService.class));
|
||||
// if the HTTPS pref changes, then update all affected things
|
||||
Preferences.get().registerLocalRepoHttpsListeners(new ChangeListener() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user