androidappactionACTIONPASSWORDFAILED androidappactionACTIONPASSWORDSUCCEEDED androidappactionDEVICEADMINDISABLED androidappactionDEVICEADMINDISABLEREQUESTED androidappactionDEVICEADMINENABLED ID: 743115
Download Presentation The PPT/PDF document "Broadcast intents android.app.action.ACT..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Broadcast intentsSlide2
android.app.action.ACTION_PASSWORD_CHANGED
android.app.action.ACTION_PASSWORD_FAILED
android.app.action.ACTION_PASSWORD_SUCCEEDEDandroid.app.action.DEVICE_ADMIN_DISABLEDandroid.app.action.DEVICE_ADMIN_DISABLE_REQUESTEDandroid.app.action.DEVICE_ADMIN_ENABLEDandroid.bluetooth.a2dp.action.SINK_STATE_CHANGEDandroid.bluetooth.adapter.action.DISCOVERY_FINISHEDandroid.bluetooth.adapter.action.DISCOVERY_STARTEDandroid.bluetooth.adapter.action.LOCAL_NAME_CHANGEDandroid.bluetooth.adapter.action.SCAN_MODE_CHANGEDandroid.bluetooth.adapter.action.STATE_CHANGEDandroid.bluetooth.device.action.ACL_CONNECTEDandroid.bluetooth.device.action.ACL_DISCONNECTEDandroid.bluetooth.device.action.ACL_DISCONNECT_REQUESTEDandroid.bluetooth.device.action.BOND_STATE_CHANGEDandroid.bluetooth.device.action.CLASS_CHANGEDandroid.bluetooth.device.action.FOUNDandroid.bluetooth.device.action.NAME_CHANGEDandroid.bluetooth.devicepicker.action.DEVICE_SELECTEDandroid.bluetooth.devicepicker.action.LAUNCHandroid.bluetooth.headset.action.AUDIO_STATE_CHANGEDandroid.bluetooth.headset.action.STATE_CHANGEDandroid.intent.action.ACTION_POWER_CONNECTEDandroid.intent.action.ACTION_POWER_DISCONNECTEDandroid.intent.action.ACTION_SHUTDOWNandroid.intent.action.AIRPLANE_MODEandroid.intent.action.BATTERY_CHANGEDandroid.intent.action.BATTERY_LOWandroid.intent.action.BATTERY_OKAYandroid.intent.action.BOOT_COMPLETEDandroid.intent.action.CAMERA_BUTTONandroid.intent.action.CONFIGURATION_CHANGED
android.intent.action.DATA_SMS_RECEIVEDandroid.intent.action.DATE_CHANGEDandroid.intent.action.DEVICE_STORAGE_LOWandroid.intent.action.DEVICE_STORAGE_OKandroid.intent.action.DOCK_EVENTandroid.intent.action.EXTERNAL_APPLICATIONS_AVAILABLEandroid.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLEandroid.intent.action.GTALK_CONNECTEDandroid.intent.action.GTALK_DISCONNECTEDandroid.intent.action.HEADSET_PLUGandroid.intent.action.INPUT_METHOD_CHANGEDandroid.intent.action.LOCALE_CHANGEDandroid.intent.action.MANAGE_PACKAGE_STORAGEandroid.intent.action.MEDIA_BAD_REMOVALandroid.intent.action.MEDIA_BUTTONandroid.intent.action.MEDIA_CHECKINGandroid.intent.action.MEDIA_EJECTandroid.intent.action.MEDIA_MOUNTEDandroid.intent.action.MEDIA_NOFSandroid.intent.action.MEDIA_REMOVEDandroid.intent.action.MEDIA_SCANNER_FINISHEDandroid.intent.action.MEDIA_SCANNER_SCAN_FILEandroid.intent.action.MEDIA_SCANNER_STARTEDandroid.intent.action.MEDIA_SHAREDandroid.intent.action.MEDIA_UNMOUNTABLEandroid.intent.action.MEDIA_UNMOUNTEDandroid.intent.action.NEW_OUTGOING_CALLandroid.intent.action.PACKAGE_ADDEDandroid.intent.action.PACKAGE_CHANGEDandroid.intent.action.PACKAGE_DATA_CLEAREDandroid.intent.action.PACKAGE_INSTALLandroid.intent.action.PACKAGE_REMOVEDandroid.intent.action.PACKAGE_REPLACED
android.intent.action.PACKAGE_RESTARTEDandroid.intent.action.PHONE_STATEandroid.intent.action.PROVIDER_CHANGEDandroid.intent.action.REBOOTandroid.intent.action.SCREEN_OFFandroid.intent.action.SCREEN_ONandroid.intent.action.TIMEZONE_CHANGEDandroid.intent.action.TIME_SETandroid.intent.action.TIME_TICKandroid.intent.action.UID_REMOVEDandroid.intent.action.UMS_CONNECTEDandroid.intent.action.UMS_DISCONNECTEDandroid.intent.action.USER_PRESENTandroid.intent.action.WALLPAPER_CHANGEDandroid.media.AUDIO_BECOMING_NOISYandroid.media.RINGER_MODE_CHANGEDandroid.media.SCO_AUDIO_STATE_CHANGEDandroid.media.VIBRATE_SETTING_CHANGEDandroid.media.action.CLOSE_AUDIO_EFFECT_CONTROL_SESSIONandroid.media.action.OPEN_AUDIO_EFFECT_CONTROL_SESSIONandroid.net.conn.BACKGROUND_DATA_SETTING_CHANGEDandroid.net.wifi.NETWORK_IDS_CHANGEDandroid.net.wifi.RSSI_CHANGEDandroid.net.wifi.SCAN_RESULTSandroid.net.wifi.STATE_CHANGEandroid.net.wifi.WIFI_STATE_CHANGEDandroid.net.wifi.supplicant.CONNECTION_CHANGEandroid.net.wifi.supplicant.STATE_CHANGEandroid.provider.Telephony.SIM_FULLandroid.provider.Telephony.SMS_RECEIVEDandroid.provider.Telephony.SMS_REJECTEDandroid.provider.Telephony.WAP_PUSH_RECEIVEDandroid.speech.tts.TTS_QUEUE_PROCESSING_COMPLETEDandroid.speech.tts.engine.TTS_DATA_INSTALLED
Complete list depends on API version and is found in
platform
/data/broadcast_actions.txtSlide3
Interesting broadcast intents
android.intent.action.ACTION_POWER_CONNECTED
android.intent.action.ACTION_POWER_DISCONNECTEDandroid.intent.action.BATTERY_CHANGEDandroid.intent.action.BATTERY_LOWandroid.intent.action.BATTERY_OKAYandroid.intent.action.BOOT_COMPLETEDandroid.intent.action.CAMERA_BUTTONandroid.intent.action.DATA_SMS_RECEIVEDandroid.intent.action.HEADSET_PLUGandroid.intent.action.NEW_OUTGOING_CALLandroid.intent.action.PHONE_STATEandroid.intent.action.REBOOTandroid.intent.action.SCREEN_OFF
android.intent.action.SCREEN_ONandroid.intent.action.TIME_TICKEvery minuteandroid.intent.action.UMS_CONNECTEDandroid.intent.action.UMS_DISCONNECTEDFor checking when usb is connectedandroid.intent.action.USER_PRESENTWhen user unlocks the screen. Note that SCREEN_ON is just for when the screen is on. But the screen might still be locked. This event is when the screen is unlockedandroid.media.RINGER_MODE_CHANGEDandroid.media.VIBRATE_SETTING_CHANGED
android.net.wifi….android.provider.Telephony.SMS_RECEIVEDSlide4
Make new app
TrackDeviceUsage
Make new class called DeviceUsageIntentReceiver extends BroadcastReceiverNote broadcast receivers must complete their execution in 10 seconds. If extensive process is needed, start a thread.In onReceive, addLog.e("GOTIT","Got :"+intent.getAction());Back in main activityAdd member variablepublic DeviceUsageIntentReceiver deviceUsageIntentReceiver = new DeviceUsageIntentReceiver();In onCreate add registerReceiver(deviceUsageIntentReceiver, new IntentFilter("android.intent.action.HEADSET_PLUG")); registerReceiver(deviceUsageIntentReceiver, new IntentFilter("android.intent.action.SCREEN_OFF")); registerReceiver(deviceUsageIntentReceiver, new IntentFilter("android.intent.action.SCREEN_ON")); registerReceiver(deviceUsageIntentReceiver, new IntentFilter
("android.intent.action.ACTION_POWER_DISCONNECTED")); registerReceiver(deviceUsageIntentReceiver, new IntentFilter("android.intent.action.ACTION_POWER_CONNECTED")); registerReceiver(deviceUsageIntentReceiver, new IntentFilter("android.intent.action.USER_PRESENT"));Add new function (this is needed so that when your app dies, the OS is not still trying to send it intents)@Overridepublic void onDestroy() {super.onPause();unregisterReceiver(deviceUsageIntentReceiver);}Run itNote: you might need to set permissions!Try opening the browser and check for screen on/off eventsThey still showHowever, to catch events when your app is not in the foreground, you should use a serviceSlide5
Send information back to Activity
In
TrackDeviceUsageActivity, addpublic DeviceUsageInfoReceiver deviceUsageInfoReceiver = new DeviceUsageInfoReceiver();public class DeviceUsageInfoReceiver extends BroadcastReceiver {@Overridepublic void onReceive(Context context, Intent intent) {Log.e("app","got: "+intent.getExtras().getString("EventName"));} }At the end of DeviceUsageIntentReceiver. onReceive, after Log.e("GOTIT","Got :"+intent.getAction());, addIntent broadcast=new Intent("edu.udel.eleg454.ReceiveDeviceUsageInfo");broadcast.putExtra("EventName", intent.getAction());context.sendBroadcast(broadcast);RunThe activity still receives messages when app is not in the foreground