@Override public void start() { String action = MqttServiceConstants.PING_SENDER + comms.getClient().getClientId(); Log.d(TAG, "Register alarmreceiver to MqttService"+ action); service.registerReceiver(alarmReceiver, new IntentFilter(action)); pendingIntent = PendingIntent.getBroadcast(service, 0, new Intent( action), PendingIntent.FLAG_UPDATE_CURRENT); schedule(comms.getKeepAlive()); hasStarted = true; }
@SuppressWarnings("deprecation") private void registerBroadcastReceivers() { if (networkConnectionMonitor == null) { networkConnectionMonitor = new NetworkConnectionIntentReceiver(); registerReceiver(networkConnectionMonitor, new IntentFilter( ConnectivityManager.CONNECTIVITY_ACTION)); } if (Build.VERSION.SDK_INT < 14 /**Build.VERSION_CODES.ICE_CREAM_SANDWICH**/) { // Support the old system for background data preferences ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); backgroundDataEnabled = cm.getBackgroundDataSetting(); if (backgroundDataPreferenceMonitor == null) { backgroundDataPreferenceMonitor = new BackgroundDataPreferenceReceiver(); registerReceiver( backgroundDataPreferenceMonitor, new IntentFilter( ConnectivityManager.ACTION_BACKGROUND_DATA_SETTING_CHANGED)); } } }
@Override public void start() { String action = MqttServiceConstants.PING_SENDER + comms.getClient().getClientId(); Log.d(TAG, "Register alarmreceiver to MqttService"+ action); service.registerReceiver(alarmReceiver, new IntentFilter(action)); pendingIntent = PendingIntent.getBroadcast(service, 0, new Intent( action), PendingIntent.FLAG_UPDATE_CURRENT); schedule(comms.getKeepAlive()); hasStarted = true; }
@Override public void start() { String action = MqttServiceConstants.PING_SENDER + comms.getClient().getClientId(); Log.d(TAG, "Register alarmreceiver to MqttService"+ action); service.registerReceiver(alarmReceiver, new IntentFilter(action)); pendingIntent = PendingIntent.getBroadcast(service, 0, new Intent( action), PendingIntent.FLAG_UPDATE_CURRENT); schedule(comms.getKeepAlive()); hasStarted = true; }
@SuppressWarnings("deprecation") private void registerBroadcastReceivers() { if (networkConnectionMonitor == null) { networkConnectionMonitor = new NetworkConnectionIntentReceiver(); registerReceiver(networkConnectionMonitor, new IntentFilter( ConnectivityManager.CONNECTIVITY_ACTION)); } if (Build.VERSION.SDK_INT < 14 /**Build.VERSION_CODES.ICE_CREAM_SANDWICH**/) { // Support the old system for background data preferences ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); backgroundDataEnabled = cm.getBackgroundDataSetting(); if (backgroundDataPreferenceMonitor == null) { backgroundDataPreferenceMonitor = new BackgroundDataPreferenceReceiver(); registerReceiver( backgroundDataPreferenceMonitor, new IntentFilter( ConnectivityManager.ACTION_BACKGROUND_DATA_SETTING_CHANGED)); } } }
@SuppressWarnings("deprecation") private void registerBroadcastReceivers() { if (networkConnectionMonitor == null) { networkConnectionMonitor = new NetworkConnectionIntentReceiver(); registerReceiver(networkConnectionMonitor, new IntentFilter( ConnectivityManager.CONNECTIVITY_ACTION)); } if (Build.VERSION.SDK_INT < 14 /**Build.VERSION_CODES.ICE_CREAM_SANDWICH**/) { // Support the old system for background data preferences ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); backgroundDataEnabled = cm.getBackgroundDataSetting(); if (backgroundDataPreferenceMonitor == null) { backgroundDataPreferenceMonitor = new BackgroundDataPreferenceReceiver(); registerReceiver( backgroundDataPreferenceMonitor, new IntentFilter( ConnectivityManager.ACTION_BACKGROUND_DATA_SETTING_CHANGED)); } } }