3

I'm writing an Android app with 3 Activity()s: A, B and C; and one Service: S. The user can start the service using activity A. The service runs for a long time, in 7 steps. Each step takes a few seconds (or minutes). Once a step has completed, I want the service to notify Activity()s B and C about its progress if they are visible. That is, I want to notify an Activity different from which has started the Service. There is no need the show an Activity if it's not visible.

How do I do that? What is the cleanest and/or simplest solution?

kat
  • 1,955
  • 4
  • 15
  • 13

1 Answers1

3

Register a receiver at runtime and listen/publish the events. This answer provides an example

Community
  • 1
  • 1
DallinDyer
  • 1,378
  • 13
  • 14