I am using Android annotation library, and I want to pass data from service to activity using broadcast receiver. I want to utilize @Reciever
of Android annotation, my attempt is same as this SO question
Any help is appreciated.
I am using Android annotation library, and I want to pass data from service to activity using broadcast receiver. I want to utilize @Reciever
of Android annotation, my attempt is same as this SO question
Any help is appreciated.
In your Activity
, add this receiver method:
@Receiver(actions = "GPSLocationUpdates", local = true)
void receiveLocationUpdates() {
// TODO
}
And broadcast your Intent
as usual from the Service
:
Intent intent = new Intent("GPSLocationUpdates");
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);