Notify activity from service

As Alex indicated, you can bind to the service and pass some sort of listener or callback to the service to use on events.

Or, you can use a broadcast Intent, perhaps using methods like setPackage() on the Intent to limit the scope of the broadcast.

Or, you can use createPendingResult() to create a PendingIntent that you pass as an Intent extra to the service — the service can then use that PendingIntent to trigger onActivityResult() in your activity.

Or, you can use a ResultReceiver.

Or, you can use a Messenger.

(admittedly, I have not tried those latter two approaches, but I think they will work here)

Leave a Comment