Questions tagged [localbroadcastmanager]

143 questions
1
vote
1 answer

LocalBroadcastManager not working as expected

In my Application I have to notify my Activity from IntentService class . For that purpose I am using LocalBroadcastManager. But I am not receiving anything in the onReceive of my Broadcast Receiver. Here is what I have written. In my BaseActivity I…
user2781627
  • 455
  • 5
  • 17
1
vote
3 answers

How to communicate between a class and an activity?

I have a class that loads multiple sounds to create a sound effect library. I use soundPool's setOnLoadCompleteListener to listen for each sound being loaded. As each sound is loaded I count the sounds and when they are all loaded I want to…
Mel
  • 6,214
  • 10
  • 54
  • 71
0
votes
1 answer

Solution for localbroadcostmanager is causing a deprication warning

I have an android Studio app trying to implement MQTT. The example I am modifying uses androidx.localbroadcastmanager.content.LocalBroadcastManager but it is deprecated. I am trying to replace this with something else but I can't find any good…
user1114881
  • 731
  • 1
  • 12
  • 25
0
votes
0 answers

How to mock LocalBroadcastManager.getInstance using mockk in unit test for Android

Unit test case failed with the following log: no answer found for: Context(child of object RuntimeContext#20).getApplicationContext() io.mockk.MockKException: no answer found for: Context(child of object RuntimeContext#20).getApplicationContext() …
Francis Bacon
  • 4,080
  • 1
  • 37
  • 48
0
votes
1 answer

How can I turn off localbroadcast listener in recyclerview adapter? Of is there a better way to communicate with an activity called from it?

I'm new to SO and fairly new to coding, so please accept my apologies in advance if I break rules or expectations here. I have an unusual setup involving two recyclerViews, which I'll explain here and also paste a simplified version of the code…
0
votes
1 answer

Data send from service to activity not working

I am calling a function in service to send data to activity, i am using Local broadcast manager for this, the below is the code in service private void sendDataToActivity(List notificationList) { Intent intent=new…
0
votes
0 answers

How to make LocalBroadcastManager safe enough

I've heard that LocalBroadcastManager is potentially insecure and that there are better options to it. I've an app that uses several of them and I think it's worthwhile to make them more secure in one way, even changing them for an Observable or the…
user2638180
  • 1,013
  • 16
  • 37
0
votes
0 answers

LocalBroadcastManager does not work on API 30

I'm adapting an app to API 30 and I've found this problem. In previous versions it works nicely with an structure like this: On my main activity I get to declare something like this: final LocalBroadcastManager mLocalBroadcastManager3; …
user2638180
  • 1,013
  • 16
  • 37
0
votes
1 answer

Any alternative's for LocalBroadcastManager, like LiveData?

I got a use case where I had to use Broadcast receivers in my project and came to know that the class "LocalBroadcastManager" has been deprecated. In the google docs they recommend using Livedate and I tried searching for a good example of it but I…
0
votes
1 answer

Android Kotlin Broad Receiever in RecyclerAdapter Won't Communicate to Broadcast Receiever in MainActivity

Context: No receiver is declared in the manifest since I am not declaring a new receiver. I am a bit confused about why the receiver in MainActivity does not receieve the broadcast sent from the recycler adapter. RecyclerAdapter …
0
votes
0 answers

How to unregister LocalBroadcastManager in ViewHolder?

I have a ViewHolder that registers as a receiver for the LocalBroadcastManager. The ViewHolder also has a delegate to the Activity that holds the RecyclerView. This causes a memory leak, because I can't manage to unregister the broadcast manager in…
0
votes
2 answers

How to send Jsoup Document in an Intent?

I'm having trouble sending objects in intents. I read that gsoup is one method to accomplish this task but I haven't been able to make it work. Here's an example. This code tries to grab the title of this stackoverflow question. It makes use of…
user10564330
0
votes
2 answers

Drawbacks in registering receivers in both the activity and service?

The scenario is like this: I have an activity and a service. There are a few things that need to be sent between both: the activity can query the service to see if running the activity can query the service for variable value the activity can ask…
Alin
  • 14,809
  • 40
  • 129
  • 218
0
votes
2 answers

Android local broadcast doesn't receive

I want to send simple sata from an activity to another. Both are active at the time and I have registered LocalBroadcastManager. the sending part work but the receiving activity doesn't get anything. BroadcastManager sending data part of the code…
Ali Has
  • 598
  • 1
  • 8
  • 24
0
votes
2 answers

LocalBroadcastManager not receiving messages correctly

I have a, what I thought was a, simple task. I have a list of achievements in a recyclerView in my MainActivity. Clicking on one of the achievements launches the AchievementDetailActivity. You do an action in the AchievementDetailActivity and it…
Neglected Sanity
  • 1,770
  • 6
  • 23
  • 46