@Override @SuppressLint("Wakelock") public void onReceive(Context context, Intent intent) { traceDebug(TAG, "Internal network status receive."); // we protect against the phone switching off // by requesting a wake lock - we request the minimum possible wake // lock - just enough to keep the CPU running until we've finished PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE); WakeLock wl = pm .newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MQTT"); wl.acquire(); traceDebug(TAG,"Reconnect for Network recovery."); if (isOnline()) { traceDebug(TAG,"Online,reconnect."); // we have an internet connection - have another try at // connecting reconnect(); } else { notifyClientsOffline(); } wl.release(); } }
@SuppressWarnings("deprecation") @Override public void onReceive(Context context, Intent intent) { ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); traceDebug(TAG,"Reconnect since BroadcastReceiver."); if (cm.getBackgroundDataSetting()) { if (!backgroundDataEnabled) { backgroundDataEnabled = true; // we have the Internet connection - have another try at // connecting reconnect(); } } else { backgroundDataEnabled = false; notifyClientsOffline(); } } }
@Override @SuppressLint("Wakelock") public void onReceive(Context context, Intent intent) { traceDebug(TAG, "Internal network status receive."); // we protect against the phone switching off // by requesting a wake lock - we request the minimum possible wake // lock - just enough to keep the CPU running until we've finished PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE); WakeLock wl = pm .newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MQTT"); wl.acquire(); traceDebug(TAG,"Reconnect for Network recovery."); if (isOnline()) { traceDebug(TAG,"Online,reconnect."); // we have an internet connection - have another try at // connecting reconnect(); } else { notifyClientsOffline(); } wl.release(); } }
@Override @SuppressLint("Wakelock") public void onReceive(Context context, Intent intent) { traceDebug(TAG, "Internal network status receive."); // we protect against the phone switching off // by requesting a wake lock - we request the minimum possible wake // lock - just enough to keep the CPU running until we've finished PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE); WakeLock wl = pm .newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MQTT"); wl.acquire(); traceDebug(TAG,"Reconnect for Network recovery."); if (isOnline()) { traceDebug(TAG,"Online,reconnect."); // we have an internet connection - have another try at // connecting reconnect(); } else { notifyClientsOffline(); } wl.release(); } }
@SuppressWarnings("deprecation") @Override public void onReceive(Context context, Intent intent) { ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); traceDebug(TAG,"Reconnect since BroadcastReceiver."); if (cm.getBackgroundDataSetting()) { if (!backgroundDataEnabled) { backgroundDataEnabled = true; // we have the Internet connection - have another try at // connecting reconnect(); } } else { backgroundDataEnabled = false; notifyClientsOffline(); } } }
@SuppressWarnings("deprecation") @Override public void onReceive(Context context, Intent intent) { ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); traceDebug(TAG,"Reconnect since BroadcastReceiver."); if (cm.getBackgroundDataSetting()) { if (!backgroundDataEnabled) { backgroundDataEnabled = true; // we have the Internet connection - have another try at // connecting reconnect(); } } else { backgroundDataEnabled = false; notifyClientsOffline(); } } }