-2

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.

Community
  • 1
  • 1
Zulqurnain Jutt
  • 1,083
  • 3
  • 15
  • 41

1 Answers1

0

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);
WonderCsabo
  • 11,947
  • 13
  • 63
  • 105