¡@

Home 

2014/10/16 ¤W¤È 08:22:23

android Programming Glossary: registerreceiver

Android: How to monitor WiFi signal strength

http://stackoverflow.com/questions/1206891/android-how-to-monitor-wifi-signal-strength

WifiManager.WIFI_STATE_ENABLING wifi.setWifiEnabled true registerReceiver new BroadcastReceiver @Override public void onReceive Context..

Android PendingIntent extras, not received by BroadcastReceiver

http://stackoverflow.com/questions/14571564/android-pendingintent-extras-not-received-by-broadcastreceiver

break Log.d DEBUG_TAG onCreate Register receivers registerReceiver deliveryBroadcastReceiver new IntentFilter DELIVERED registerReceiver.. deliveryBroadcastReceiver new IntentFilter DELIVERED registerReceiver sendBroadcastReceiver new IntentFilter SENT mContext getApplicationContext.. Unregister receivers if sendBroadcastReceiver null unregisterReceiver sendBroadcastReceiver sendBroadcastReceiver null if deliveryBroadcastReceiver..

Android - how to receive broadcast intents ACTION_SCREEN_ON/OFF?

http://stackoverflow.com/questions/1588061/android-how-to-receive-broadcast-intents-action-screen-on-off

only be received by receivers registered in Java code via registerReceiver rather than through receivers registered in the manifest. share..

android.intent.action.SCREEN_ON doesn't work as a receiver intent filter

http://stackoverflow.com/questions/2575242/android-intent-action-screen-on-doesnt-work-as-a-receiver-intent-filter

intercept this event successfully with a call to Context.registerReceiver like so registerReceiver new BroadcastReceiver @Override public.. with a call to Context.registerReceiver like so registerReceiver new BroadcastReceiver @Override public void onReceive Context..

More efficient way of updating UI from Service than intents?

http://stackoverflow.com/questions/2621395/more-efficient-way-of-updating-ui-from-service-than-intents

filter.addAction CallManager.SIP_RINGING_CALL_INTENT registerReceiver SipCallListener filter This works however it seems like it is..

On logout, clear Activity history stack, preventing “back” button from opening logged-in-only Activites

http://stackoverflow.com/questions/3007998/on-logout-clear-activity-history-stack-preventing-back-button-from-opening-l

intentFilter.addAction com.package.ACTION_LOGOUT registerReceiver new BroadcastReceiver @Override public void onReceive Context..

How can I monitor the network connection status in Android?

http://stackoverflow.com/questions/3307237/how-can-i-monitor-the-network-connection-status-in-android

Get battery level before broadcast receiver responds for Intent.ACTION_BATTERY_CHANGED

http://stackoverflow.com/questions/3661464/get-battery-level-before-broadcast-receiver-responds-for-intent-action-battery-c

int level intent.getIntExtra level 0 do something... registerReceiver this.mBatInfoReceiver new IntentFilter Intent.ACTION_BATTERY_CHANGED.. the battery level was on the last broadcast You can call registerReceiver with your IntentFilter and a null BroadcastReceiver to get the..

How to use a custom typeface in a widget?

http://stackoverflow.com/questions/4318572/how-to-use-a-custom-typeface-in-a-widget

@Override public void onCreate super.onCreate reinit registerReceiver mTimeChangedReceiver sIntentFilter @Override public void onDestroy.. @Override public void onDestroy super.onDestroy unregisterReceiver mTimeChangedReceiver @Override public void onStart Intent intent..

Programmatically register a broadcast receiver

http://stackoverflow.com/questions/4805269/programmatically-register-a-broadcast-receiver

are active not dynamically register a receiver via Context.registerReceiver while running. If so you can use PackageManager.setComponentEnabledSetting.. a broadcast while you are running it is better to use registerReceiver . A receiver component is primarily useful for when you need..

BroadcastReceiver as inner class

http://stackoverflow.com/questions/4854807/broadcastreceiver-as-inner-class

... ... ... public void onResume super.onResume .... registerReceiver myBroadcastReceiver intentFilter public void onPause super.onPause..

Detecting MMS messages on Android

http://stackoverflow.com/questions/5329819/detecting-mms-messages-on-android

IntentFilter mIntentFilter.addAction MMSMON_RECEIVED_MMS registerReceiver mmsMonitorBroadcastReceiver mIntentFilter getApplicationContext..

How can I get Android Wifi Scan Results into a list?

http://stackoverflow.com/questions/5452940/how-can-i-get-android-wifi-scan-results-into-a-list

new int R.id.list_value lv.setAdapter this.adapter registerReceiver new BroadcastReceiver @Override public void onReceive Context..

Android WIFI How To Detect When WIFI Connection has been established

http://stackoverflow.com/questions/5888502/android-wifi-how-to-detect-when-wifi-connection-has-been-established

WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION registerReceiver broadcastReceiver intentFilter And then in your BroadcastReceiver..

Android - registering a headset button click with BroadcastReceiver

http://stackoverflow.com/questions/6287116/android-registering-a-headset-button-click-with-broadcastreceiver

MediaButtonIntentReceiver r new MediaButtonIntentReceiver registerReceiver r filter Nothing happens though when I push the button though... r new MediaButtonIntentReceiver filter.setPriority 1000 registerReceiver r filter It was able to work even with the other app installed...

Receiving package install and uninstall events

http://stackoverflow.com/questions/7470314/receiving-package-install-and-uninstall-events

intentFilter.addAction Intent.ACTION_PACKAGE_INSTALL registerReceiver br intentFilter This should make a toast when a new app is installed... intentFilter.addDataScheme package registerReceiver br intentFilter This should work for you. share improve this..

Android: How to monitor WiFi signal strength

http://stackoverflow.com/questions/1206891/android-how-to-monitor-wifi-signal-strength

if wifi.isWifiEnabled if wifi.getWifiState WifiManager.WIFI_STATE_ENABLING wifi.setWifiEnabled true registerReceiver new BroadcastReceiver @Override public void onReceive Context context Intent intent WifiInfo info wifi.getConnectionInfo..

Android PendingIntent extras, not received by BroadcastReceiver

http://stackoverflow.com/questions/14571564/android-pendingintent-extras-not-received-by-broadcastreceiver

getBaseContext SMS not delivered Toast.LENGTH_SHORT .show break Log.d DEBUG_TAG onCreate Register receivers registerReceiver deliveryBroadcastReceiver new IntentFilter DELIVERED registerReceiver sendBroadcastReceiver new IntentFilter SENT mContext.. Log.d DEBUG_TAG onCreate Register receivers registerReceiver deliveryBroadcastReceiver new IntentFilter DELIVERED registerReceiver sendBroadcastReceiver new IntentFilter SENT mContext getApplicationContext setContentView R.layout.main ... Bind views and.. void onDestroy Unregister receivers Log.d DEBUG_TAG onDestroy Unregister receivers if sendBroadcastReceiver null unregisterReceiver sendBroadcastReceiver sendBroadcastReceiver null if deliveryBroadcastReceiver null unregisterReceiver deliveryBroadcastReceiver..

Android - how to receive broadcast intents ACTION_SCREEN_ON/OFF?

http://stackoverflow.com/questions/1588061/android-how-to-receive-broadcast-intents-action-screen-on-off

android.intent.action.SCREEN_ON doesn't work as a receiver intent filter

http://stackoverflow.com/questions/2575242/android-intent-action-screen-on-doesnt-work-as-a-receiver-intent-filter

perhaps no longer supported Previously I have been able to intercept this event successfully with a call to Context.registerReceiver like so registerReceiver new BroadcastReceiver @Override public void onReceive Context context Intent intent ... new IntentFilter.. Previously I have been able to intercept this event successfully with a call to Context.registerReceiver like so registerReceiver new BroadcastReceiver @Override public void onReceive Context context Intent intent ... new IntentFilter Intent.ACTION_SCREEN_ON..

More efficient way of updating UI from Service than intents?

http://stackoverflow.com/questions/2621395/more-efficient-way-of-updating-ui-from-service-than-intents

filter new IntentFilter CallManager.SIP_INCOMING_CALL_INTENT filter.addAction CallManager.SIP_RINGING_CALL_INTENT registerReceiver SipCallListener filter This works however it seems like it is not very efficient the Intents will get broadcast system wide..

On logout, clear Activity history stack, preventing “back” button from opening logged-in-only Activites

http://stackoverflow.com/questions/3007998/on-logout-clear-activity-history-stack-preventing-back-button-from-opening-l

savedInstanceState snip IntentFilter intentFilter new IntentFilter intentFilter.addAction com.package.ACTION_LOGOUT registerReceiver new BroadcastReceiver @Override public void onReceive Context context Intent intent Log.d onReceive Logout in progress..

How can I monitor the network connection status in Android?

http://stackoverflow.com/questions/3307237/how-can-i-monitor-the-network-connection-status-in-android

Get battery level before broadcast receiver responds for Intent.ACTION_BATTERY_CHANGED

http://stackoverflow.com/questions/3661464/get-battery-level-before-broadcast-receiver-responds-for-intent-action-battery-c

@Override public void onReceive Context arg0 Intent intent int level intent.getIntExtra level 0 do something... registerReceiver this.mBatInfoReceiver new IntentFilter Intent.ACTION_BATTERY_CHANGED However this code has to wait for the battery status.. this to get it working or simply run some code to see what the battery level was on the last broadcast You can call registerReceiver with your IntentFilter and a null BroadcastReceiver to get the last broadcast Intent . This works because ACTION_BATTERY_CHANGED..

How to use a custom typeface in a widget?

http://stackoverflow.com/questions/4318572/how-to-use-a-custom-typeface-in-a-widget

sIntentFilter.addAction Intent.ACTION_TIME_CHANGED @Override public void onCreate super.onCreate reinit registerReceiver mTimeChangedReceiver sIntentFilter @Override public void onDestroy super.onDestroy unregisterReceiver mTimeChangedReceiver.. reinit registerReceiver mTimeChangedReceiver sIntentFilter @Override public void onDestroy super.onDestroy unregisterReceiver mTimeChangedReceiver @Override public void onStart Intent intent int startId super.onStart intent startId if ACTION_UPDATE.equals..

Programmatically register a broadcast receiver

http://stackoverflow.com/questions/4805269/programmatically-register-a-broadcast-receiver

to control whether components published in your manifest are active not dynamically register a receiver via Context.registerReceiver while running. If so you can use PackageManager.setComponentEnabledSetting to control whether these components are active.. int int Note if you are only interested in receiving a broadcast while you are running it is better to use registerReceiver . A receiver component is primarily useful for when you need to make sure your app is launched every time the broadcast..

BroadcastReceiver as inner class

http://stackoverflow.com/questions/4854807/broadcastreceiver-as-inner-class

new BroadcastReceiver @Override public void onReceive ... ... ... public void onResume super.onResume .... registerReceiver myBroadcastReceiver intentFilter public void onPause super.onPause ... unregisterReceiver myBroadcastReceiver ... share..

Detecting MMS messages on Android

http://stackoverflow.com/questions/5329819/detecting-mms-messages-on-android

log.append n MMS Received IntentFilter mIntentFilter new IntentFilter mIntentFilter.addAction MMSMON_RECEIVED_MMS registerReceiver mmsMonitorBroadcastReceiver mIntentFilter getApplicationContext .getContentResolver .registerContentObserver mmsInURI true..

How can I get Android Wifi Scan Results into a list?

http://stackoverflow.com/questions/5452940/how-can-i-get-android-wifi-scan-results-into-a-list

WiFiDemo.this arraylist R.layout.row new String ITEM_KEY new int R.id.list_value lv.setAdapter this.adapter registerReceiver new BroadcastReceiver @Override public void onReceive Context c Intent intent results wifi.getScanResults size results.size..

Android WIFI How To Detect When WIFI Connection has been established

http://stackoverflow.com/questions/5888502/android-wifi-how-to-detect-when-wifi-connection-has-been-established

IntentFilter intentFilter new IntentFilter intentFilter.addAction WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION registerReceiver broadcastReceiver intentFilter And then in your BroadcastReceiver do something like this @Override public void onReceive..

Android - registering a headset button click with BroadcastReceiver

http://stackoverflow.com/questions/6287116/android-registering-a-headset-button-click-with-broadcastreceiver

filter new IntentFilter Intent.ACTION_MEDIA_BUTTON MediaButtonIntentReceiver r new MediaButtonIntentReceiver registerReceiver r filter Nothing happens though when I push the button though. I'm pretty sure something is wrong with my permissions xml.. android.intent.action.MEDIA_BUTTON MediaButtonIntentReceiver r new MediaButtonIntentReceiver filter.setPriority 1000 registerReceiver r filter It was able to work even with the other app installed. Also you don't need both the above AND the XML one or the..

Receiving package install and uninstall events

http://stackoverflow.com/questions/7470314/receiving-package-install-and-uninstall-events

IntentFilter intentFilter.addAction Intent.ACTION_PACKAGE_ADDED intentFilter.addAction Intent.ACTION_PACKAGE_INSTALL registerReceiver br intentFilter This should make a toast when a new app is installed. But sadly it does not. It does not enter in the onReceive..