Questions tagged [localbroadcastmanager]
143 questions
1
vote
0 answers
Cannot execute LocalBroadcastManager from JobIntentService
I've a JobIntentService, in which if certain conditions are met, it must launch a LocalBroadCastManager that is received by my MainActivity.
I'm doing it this way:
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager
…

user2638180
- 1,013
- 16
- 37
1
vote
1 answer
Kotlin LocalBroadcastManager not working after call to display values on UI
I have an android application I am working on in which I am making API request with Volley, after making the API call, I get a bunch of JSON objects returned. I now saved the values into a default values. after saving, I now tried displaying the…

King
- 1,885
- 3
- 27
- 84
1
vote
1 answer
Update UI at onResume using LocalBroadcastManager
I have a Service that frequently updates the Main Activity UI by passing values via a LocalBroadCastManager. The following method is triggered within the Service to pass the value to the Main Activity:
private void updateUI(String statusValue){
…

Basmatti
- 27
- 8
1
vote
0 answers
Localbroadcastmanager not working. Getting latitude and longitude
My app is about getting location in background service. However, it cannot return latitude and longitude. Here is the code.
Service side:
public class Map extends Service implements
GoogleApiClient.ConnectionCallbacks,
…

belllele
- 31
- 1
- 5
1
vote
2 answers
Local Broadcast not updating UI
i have this code in my register user activity:
val userDataChange = Intent(BROADCAST_USER_DATA_CHANGE)
userDataChange.putExtra("aaa", "aaaaaaaa")
userDataChange.putExtra("bbb",…

Nir Golan
- 270
- 1
- 3
- 15
1
vote
2 answers
can a receiver be registered with LocalBroadcastmanager to execute in a different thread
Can a receiver be registered with LocalBroadcastManager to execute in a different thread?
We register for an intent with LocalBroadcastmanager using
void registerReceiver (BroadcastReceiver receiver, IntentFilter filter)
Suppose I want the…

gopal
- 39
- 6
1
vote
0 answers
Robolectric fails to mock LocalBroadcastManager
at org.robolectric.shadows.support.v4.
ShadowLocalBroadcastManager.shadowOf(ShadowLocalBroadcastManager.java:42)
I am getting the above error when trying to test a class, which using a LocalBroadcastManager. I am using Robolectric and Mockito to…

narancs
- 5,234
- 4
- 41
- 60
1
vote
1 answer
Android - Is it possible to declare Local Broadcast receiver in the manifest file?
I have declared my receiver in my manifest:
…

ban-geoengineering
- 18,324
- 27
- 171
- 253
1
vote
1 answer
LocalBroadcastManager: Receive events when app is closed
I try to integrate the beaconinside sdk into my app and I want to receive the events sent through the Beaconservice even when my app is closed and removed from the app drawer (recent apps).
Now my code looks like so
BeaconFragment
@Override
public…

LimitX
- 595
- 3
- 7
- 23
1
vote
0 answers
Android ANR on registerReceiver
My app crashes sometimes on this line:
LocalBroadcastManager.getInstance(context.getApplicationContext()).
registerReceiver(handler, new IntentFilter("DATA_UPDATE"));
In traces.txt I found out, that registerReiceiver is blocked by a…

Peter
- 1,011
- 2
- 16
- 39
1
vote
5 answers
android: how to receive broadcast from service when the app is inactive
When my service is running and I can see my app on the screen, everything works fine. My service sends broadcast messages and I can see them in my "MainActivity". But as soon as I push the home button and my app is no longer in the foreground, it…

user3137385
- 315
- 5
- 14
1
vote
2 answers
Android: how to have a localbroadcast reciever inside service
I have service in which I want to have a localbroadcast receiver. I want to recieve a value from the activity to my services onCreate.
Note: I can get a value from an activity to my service in onStartCommand() using intent. But here I want a value…

Santhosh
- 9,965
- 20
- 103
- 243
1
vote
1 answer
Two receivers of android LocalBroadcast, one in MainActivity, the other in a fragment
In a android app, I registered a receiver in MainActivity's onCreate
IntentFilter mFilter = new IntentFilter("Action");
LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, mFilter);
In its onResume
new Thread(new Runnable() {
…

J.E.Y
- 1,173
- 2
- 15
- 37
1
vote
0 answers
Service bindService vs LocalBroadcastManager
I have multiple activities and a background always running service (see context here).
Which approach is better, use bindService() or app confined notifications using sendBroadcast() and a BroadcastReceiver in each activity?
Thanks

Gabe
- 5,997
- 5
- 46
- 92
1
vote
0 answers
android LocalBroadcast not received some times randomly
I am listening for Media mounted and unmounted events as below
…

nmxprime
- 1,506
- 3
- 25
- 52