Questions tagged [localbroadcastmanager]

143 questions
4
votes
1 answer

LocalBroadcastManager with Widget

How can I register my App Widget (home screen widget) to listen to local broadcast messages that send over LocalBroadcastManager?
nrofis
  • 8,975
  • 14
  • 58
  • 113
4
votes
2 answers

How to use LocalBroadcastManager without Activity

I had my class 'ABC' by extending the BroadcastReceiver. But recently, I stumbled upon LocalBroadcastManager. here is my class declaration: public class ABC extends BroadcastReceiver {} So ABC is working as the listener and based on the action it…
user2771655
  • 1,052
  • 3
  • 20
  • 38
4
votes
2 answers

Locally managed broadcast receiver leak?

Is it possible that a local (i.e. managed with LocalBroadcastManager) BroadcastReceiver leaks when the app is killed by the system? The specific use case for which I need it is that I would like to register/unregister the BroadcastReceiver in an…
3
votes
0 answers

What is the alternative to LocalBroadcastManager?

I am trying to integrate my android project with freshchat SDK and it depends on LocalBroadcastManager but it's deprecated . So what should I use instead of LocalBroadcastManager in this scenario ? @Override public void onCreate() { …
Omar Abdelazeem
  • 381
  • 2
  • 20
3
votes
1 answer

How can I write unit tests for classes using LocalBroadcastManager?

Our normal way of writing unit tests is using mocks via Mockito. However, LocalBroadcastManager, for some unexplicable reason, is final - thus preventing Mockito from expanding it, which prevents us to mock/spy it... --> How can I write unit tests…
fgysin
  • 11,329
  • 13
  • 61
  • 94
3
votes
2 answers

How to use Xamarin Android LocalBroadcastManager

I've been searching for a way to send a local message within my app and found a tutorial from the Xamarin website on Broadcast Receivers here, more specifically at the bottom of the web page concerning LocalBroadcastManager. I followed the tutorial…
3
votes
0 answers

Broadcast Receiver from Service to Fragment not working properly

I've implemented a Broadcast Receiver to pass data each second from Service that is running a CountDownTimer with the time remaining to the Fragment. The problem is that Fragment is not receiving data properly or better to say that is receiving it…
Kiwi
  • 173
  • 2
  • 9
3
votes
1 answer

LocalBroadcastManager not receiving broadcasts in a Activity

I am using a LocalBroadcastManager to make broadcast to my activtiy and services using APPLICATION CONTEXT , like this: public class CommonForApp extends Application{ public void broadcastUpdateUICommand(String[] updateFlags, …
3
votes
1 answer

onReceive not being called when BroadcastReceiver is registered using LocalBroadcastManager

I've created a BroadcastReceiver to receive ACTION_DOWNLOAD_COMPLETE when my app starts downloading something using DownloadManager. As I want to capture ACTION_DOWNLOAD_COMPLETE only when downloading is started from my app, I've used…
3
votes
2 answers

How to implement the timer to run inside Alarm Receiver even after the app quits?

I have used Alarm Service. I have implemented the the alarm to run on every 1 minute. So the broadcast receiver onReceive method gets called even after the app quits. I want to implement a timer inside of this onReceive method. I have to start…
M Vignesh
  • 1,586
  • 2
  • 18
  • 55
3
votes
1 answer

How to pass a handler to LocalBroadcastManager.registerReceiver(...)

Android provides a global registerReceiver() with a signature that takes a Handler. When using LocalBroadcastManager.registerReceiver(), there is no method that takes a Handler. Why? How can I provide a Handler which will process the broadcast?
zyamys
  • 1,609
  • 1
  • 21
  • 23
3
votes
1 answer

Local Broadcast null pointer exception

I have a local broadcast inside an intentService which sends a message to an activity. the problem is am getting a null pointer exception. any help is appreciated :) LogCat Error 01-22 17:57:15.461: I/Arrival(16592): This is instantated 01-22…
3
votes
1 answer

Global broadcast or local broadcast with PendingIntent

I run a background task in an IntentService. I show progress in notification bar (with NotificationManager), and want to cancel the task if somebody click on that notification. I implemented it successfully with broadcast service. However, I was…
abdfahim
  • 2,523
  • 10
  • 35
  • 71
2
votes
1 answer

How to Communicate between Activity and Service using LocalBroadcastManager in a different Process

I have a Service which is in a different process defined in Manifest and a MapboxMap Activity, and I just wanted to know how I can communicate between my Service and Activity using LocalBroadcastManager. I've tried to pass the Service Context to…
2
votes
1 answer

Why does a BroadcastReceiver work without an instance?

In this tutorial a class derives from BroadcastReceiver. It then receives messages. How? This is just a definition of a class, not an instance of it! And after we figure that out - how do we prevent this from happening so that we can use this class…
ispiro
  • 26,556
  • 38
  • 136
  • 291
1
2
3
9 10