I have a service that gets the user's location and broadcasts the latitude and longitude in an intent.
I believe that I need the service to be a started service (as opposed to bound service), because I would like for it to be able to send a push notification to the user when a new geoFire entry from firebase enters their radius even when the app is closed.
Currently, the service is set up to broadcast the location.
Given that the location service will be a started service, I don't know how to access the broadcast from two separate activities.
I believe that I could achieve this if it were a bound service, but since I want it to stay alive indefinitely, I'm not sure what to do.
Here is a minimal example that demonstrates my issue.
Specifically, I can get the latitude and longitude to display on the first activity by registering a broadcast receiver, but I can't get the latitude and longitude to display on the second activity by registering a separate broadcast receiver.
I have read Android's documentation on Services but still don't really know what I'm supposed to do to resolve this problem.
I've been testing this all on an emulator from Android Studio: Nexus 5X API 25 x86.
UPDATE Nov. 8, 2017: I've updated the github project to contain the EventBus solution provided below. It is in the eventBus branch. The master branch still contains the ualtered, problematic code pertaining to the question.
To view:
git clone https://github.com/Atticus29/locationServiceMCV.git
git checkout eventBus
Then, open AndroidStudio or IDE of choice and view/run as you normally would.