Reputation: 3582
I want to broadcast my locationUpdate from GoogleApi (which is inside Service) to 3 different activities. I can implement a simple callback, but this way I can send my location only to one place.
@Override
public void onLocationChanged(Location location) {
mLocationCallback.handleNewLocation(location);
}
On another hand I can create BroadCastReceiver:
private BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
notifyListDataChanged();
}
};
but it looks ugly and takes a lot of time to code and maintain. Is there any other simple way to broadcast location updates from Service
Upvotes: 0
Views: 24
Reputation: 30088
There are several message bus implementations for Android, including Otto, EventBus, and others. Any one of them should work for this.
Upvotes: 1