localbroadcastmanager

Register a Local BroadcastReceiver in AndroidManifest.xml?

妖精的绣舞 提交于 2019-11-30 00:14:21
问题 Is there anyway to register a BroadcastReceiver in AndroidManifest.xml and receives broadcast that is send by a LocalBroadcastManager? Currently I must call registerReceiver(BroadcastReceiver receiver, IntentFilter filter) to register a Receiver, declare in AndroidManifest.xml won't work. But this means I must know exactly the receiver's package name and class name, not just the intent filter. Is it possible to declare the receiver in the manifest file? following is my current code.

On which thread does onReceive() of a BroacastReceiver registered with LocalBroadcastManager run?

*爱你&永不变心* 提交于 2019-11-29 09:42:39
I register a broadcast receiver in a preference activity and send it a (sync) broadcast from a (Wakeful) IntentService. Apparently onReceive runs on the service's thread. Is this a fault of my part ? Is it documented behavior ? Preference activity: public final class SettingsActivity extends BaseSettings { private static CharSequence sMasterKey; private CheckBoxPreference mMasterPref; // Receiver /** If the master preference is changed externally this reacts */ private BroadcastReceiver mExternalChangeReceiver = new ExternalChangeReceiver(); public static void notifyMonitoringStateChange

Communication between Android Services and Activities

寵の児 提交于 2019-11-29 02:37:45
I want to develop an Android App with three activities and two services. The first Service, named WebClientService , calls a REST API every 30 seconds, using an Handler, and has to notify the active Activity with the result. It also has to notify a second Service, named DatabaseService , in order to update a local DB. The Database Service will be called just once onCreate of the activity (in case of app crash and restart) and just once at onRestart (in this way we have data to show in case there were connectivity issues). The activities will then keep themselves updated thanks to the

Otto vs LocalBroadcast:

孤街浪徒 提交于 2019-11-28 17:25:41
I am a huge fan of open source contributions square has done to the Android community and was looking into their latest contribution Otto (event bus ) http://square.github.io/otto/ Digging deeper I see that Otto uses reflection and there is no ordered broadcast ( a pattern where a unconsumed message is handed down from one receiver to the next receiver listening on the same type of event ) Otto believes in more of a fire and forget model . Now android has LocalBroadcastManager (LBM ) in its v4 support library which serves the same purpose , though it's more bulkier and has more restrictions on

On which thread does onReceive() of a BroacastReceiver registered with LocalBroadcastManager run?

夙愿已清 提交于 2019-11-28 03:07:20
问题 I register a broadcast receiver in a preference activity and send it a (sync) broadcast from a (Wakeful) IntentService. Apparently onReceive runs on the service's thread. Is this a fault of my part ? Is it documented behavior ? Preference activity: public final class SettingsActivity extends BaseSettings { private static CharSequence sMasterKey; private CheckBoxPreference mMasterPref; // Receiver /** If the master preference is changed externally this reacts */ private BroadcastReceiver

Communication between Android Services and Activities

和自甴很熟 提交于 2019-11-27 21:54:44
问题 I want to develop an Android App with three activities and two services. The first Service, named WebClientService , calls a REST API every 30 seconds, using an Handler, and has to notify the active Activity with the result. It also has to notify a second Service, named DatabaseService , in order to update a local DB. The Database Service will be called just once onCreate of the activity (in case of app crash and restart) and just once at onRestart (in this way we have data to show in case

Otto vs LocalBroadcast:

霸气de小男生 提交于 2019-11-27 10:27:04
问题 I am a huge fan of open source contributions square has done to the Android community and was looking into their latest contribution Otto (event bus ) http://square.github.io/otto/ Digging deeper I see that Otto uses reflection and there is no ordered broadcast ( a pattern where a unconsumed message is handed down from one receiver to the next receiver listening on the same type of event ) Otto believes in more of a fire and forget model . Now android has LocalBroadcastManager (LBM ) in its