Questions tagged [localbroadcastmanager]

143 questions
45
votes
3 answers

Otto vs LocalBroadcast:

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…
Chris
  • 798
  • 1
  • 9
  • 15
29
votes
1 answer

Register a Local BroadcastReceiver in AndroidManifest.xml?

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,…
teejoe
  • 673
  • 2
  • 6
  • 17
26
votes
5 answers

Can not resolve import LocalBroadcastManager on statement android.support.v4.content.LocalBroadcastManager;

I got this error while importing an eclipse project to Android studio. It shows a suggestion Add library Gradle: com.android.support:support-core-utils-27.1.1 to classpath. I have added the library in my build.gradle file. Here is my gradle…
Jack
  • 1,825
  • 3
  • 26
  • 43
22
votes
1 answer

LocalBroadcastManager has been deprecated. What I should use instead in its place?

I'm working on this project in Android in which an aspect requires a CountdownTimer with a foreground service. A few other answers on Stack Overflow mentioned that LocalBroadcastManager would be suitable for my needs. The documentation in Android…
13
votes
1 answer

Local broadcast from Service not received by Activity

I have an Activity in which I am registering a BroadcastReceiver locally as follows: public class SomeActivity extends Activity{ public static final String PERFORM_SOME_ACTION = "PERFORM_SOME_ACTION"; @Override protected void…
11
votes
2 answers

Can i use AlarmManager with LocalBroadcastManager on android?

I've got this code: private AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE); private PendingIntent alarmIntent = PendingIntent.getBroadcast(this, 0, new Intent("my action-name"),…
Bartłomiej Mucha
  • 2,762
  • 1
  • 30
  • 36
10
votes
2 answers

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

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…
Mr_and_Mrs_D
  • 32,208
  • 39
  • 178
  • 361
8
votes
5 answers

LocalBroadcastManager is now deprecated, how to send data from service to activity?

I have a service that needs to notify the main activity. I use LocalBroadcastManager, and it works fine, but LocalBroadcastManager has been deprecated. This is my actual code in the service: public void onTokenRefresh() { /* build the…
zeus
  • 12,173
  • 9
  • 63
  • 184
8
votes
1 answer

Is there a way to tell if LocalBroadcastManager broadcasts were received?

Is there a way to tell if LocalBroadcastManager broadcasts were received? Or are being listened to? Basically I have an IntentService listening for Google Cloud Messages. When it gets one I need to either show a notification OR alert my main Service…
7
votes
4 answers

Communication between Android Services and Activities

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…
Gabe
  • 5,997
  • 5
  • 46
  • 92
7
votes
1 answer

BroadcatReceiver declared in manifest.xml not receiving LocalBroadcastManager intents

While it is possible to declare a 'Local' BroadcastReceiver via code so it receives intents published via a LocalBroadcastManager.Ex LocalBroadcastManager.getInstance(this).registerReceiver(new FooReceiver(), new…
5
votes
4 answers

LocalBroadcastManager and the Activity lifecycle

So I'm looking into the feasibility of changing from callback interfaces to local broadcasts for some long-running network operations. Since the Activity lifecycle creates all sorts of complication for asynchronous requests that need to modify the…
Kevin Coppock
  • 133,643
  • 45
  • 263
  • 274
4
votes
1 answer

How to call different methods with LocalBroadcastManager

I have 3 menu buttons (add_image,save_meme and share_meme) on my action bar, which are declared in Mainactivity.java. The buttons are responsible for calling the corresponding methods in another fragment. The connection is established with…
4
votes
0 answers

Android Activity communication with IntentService

I need to have a two way communication between my activity and a running IntentService. The scenario is like this: the app can schedule alarms which on run, start an IntentService which fetches some data from web and process it. There are three…
Alin
  • 14,809
  • 40
  • 129
  • 218
4
votes
0 answers

NullPointerException in LocalBroadcastManager

I've tried to update my list after the SMS arrives. I get the receiver correctly, but when i try to send the receiver to my class I get the following error in the some phones. 05-20 09:50:57.749: E/AndroidRuntime(8873):…
user2910110
1
2 3
9 10