0

I have been looking for solutions for this, but there doesn't seem to be any. I have a fairly unique use case that I need to be able to pass data between two different apps even when one app isn't active, therefore my BroadcastReceivers need to be registered in the manifest. However, what I can't seem to figure out is how I pass the received data from my manifest-registered BroadcastReceivers to my activities. Most of the examples are using dynamically registered BroadcastReceivers, which will not work in my use case.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Pink Jazz
  • 784
  • 4
  • 13
  • 34
  • You can use a `Service` and inside that you can register yours BroadcastReceivers. – Augusto May 30 '19 at 17:18
  • "how I pass the received data from my manifest-registered BroadcastReceivers to my activities" -- there may not be any activities. If the receiving app did not have a process running, Android will fork a process to respond to the broadcast, but there will be no running activities in that process. " I have a fairly unique use case that I need to be able to pass data between two different apps even when one app isn't active" -- perhaps you should ask a separate Stack Overflow question, explaining the nature of this flow, and asking for advice on how best to implement it. – CommonsWare May 30 '19 at 17:56
  • You seem to be basing your assumptions on [this](https://stackoverflow.com/q/56118445/115145), and while Dave's answer is correct, a broadcast is not the only option. It may not be the best option. However, without **details of what you are trying to accomplish**, we cannot give you much assistance. – CommonsWare May 30 '19 at 17:58
  • https://stackoverflow.com/questions/56383756/android-best-approach-for-inter-app-communcation-without-foregrounding-them – Pink Jazz May 30 '19 at 18:29

1 Answers1

0

Even though it is hard to say without knowing what you are trying to accomplish, two solutions come into mind; one being receiving with permissions and the other is WorkManager to schedule work regardless of your user is using your app or exited your app.

The_Martian
  • 3,684
  • 5
  • 33
  • 61