@Override public void handleMessage(Message msg) { Log.v("TTSNotifierService", "handleMessage()"); Intent intent = (Intent) msg.obj; String action = intent.getAction(); readState(); storeAndUpdateVolume(); boolean cbxEnable = mPrefs.getBoolean("cbxEnable", false); boolean cbxObeySilentMode = mPrefs.getBoolean("cbxObeySilentMode", true); if (action == null) return; if (!cbxEnable) return; if (cbxObeySilentMode && silentMode) return; // When calling ignore other notifications if (!ACTION_PHONE_STATE.equals(action) && (mTelephonyManager.getCallState() != TelephonyManager.CALL_STATE_IDLE)) return; Log.v("TTSNotifierService", "Action: " + action); if (ACTION_PHONE_STATE.equals(action)) { handleACTION_PHONE_STATE(intent); } else if (ACTION_SMS_RECEIVED.equals(action)) { handleACTION_SMS_RECEIVED(intent); } else if (ACTION_BATTERY_LOW.equals(action)) { handleACTION_BATTERY_LOW(intent); } else if (ACTION_MEDIA_BAD_REMOVAL.equals(action)) { handleACTION_MEDIA_BAD_REMOVAL(intent); } else if (ACTION_BOOT_COMPLETED.equals(action)) { handleACTION_BOOT_COMPLETED(intent); } else if (ACTION_PROVIDER_CHANGED.equals(action)) { handleACTION_PROVIDER_CHANGED(intent); } else if (ACTION_MEDIA_MOUNTED.equals(action)) { handleACTION_MEDIA_MOUNTED(intent); } else if (ACTION_MEDIA_UNMOUNTED.equals(action)) { handleACTION_MEDIA_UNMOUNTED(intent); } else if (ACTION_PICK_WIFI_NETWORK.equals(action)) { handleACTION_PICK_WIFI_NETWORK(intent); } else if (ACTION_WIFI_STATE_CHANGE.equals(action)) { handleACTION_WIFI_STATE_CHANGE(intent); } else if (ACTION_SUPPLICANT_CONNECTION_CHANGE_ACTION.equals(action)) { handleSUPPLICANT_CONNECTION_CHANGE_ACTION(intent); } // ACTION_PHONE_STATE is different because we are using a thread in it if (!ACTION_PHONE_STATE.equals(action)) restoreVolume(); }
@Override public void handleMessage(Message msg) { int serviceId = msg.arg1; Intent intent = (Intent) msg.obj; String action = intent.getAction(); // String dataType = intent.getType(); if (ACTION_SMS_RECEIVED.equals(action)) { handleSmsReceived(intent); } // NOTE: We MUST not call stopSelf() directly, since we need to // make sure the wake lock acquired by AlertReceiver is released. finishStartingService(SmsReceiverService.this, serviceId); }
@Override public void handleMessage(Message msg) { if (Log.DEBUG) Log.v("SMSReceiverService: handleMessage()"); int serviceId = msg.arg1; Intent intent = (Intent) msg.obj; String action = intent.getAction(); String dataType = intent.getType(); if (ACTION_SMS_RECEIVED.equals(action)) { handleSmsReceived(intent); } else if (ACTION_MMS_RECEIVED.equals(action) && MMS_DATA_TYPE.equals(dataType)) { handleMmsReceived(intent); } else if (MESSAGE_SENT_ACTION.equals(action)) { handleSmsSent(intent); } else if (ACTION_MESSAGE_RECEIVED.equals(action)) { handleMessageReceived(intent); } // NOTE: We MUST not call stopSelf() directly, since we need to // make sure the wake lock acquired by AlertReceiver is released. finishStartingService(SmsReceiverService.this, serviceId); }