Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement callbacks using IntentService on Android?

If it must implement with AIDL? And please kindly provide an example, thanks.

EDIT: There are several solutions, Does anyone know which is better?

like image 693
shiami Avatar asked Dec 29 '22 06:12

shiami


1 Answers

You might be looking for the ResultReceiver class (http://developer.android.com/reference/android/os/ResultReceiver.html).
You extend it, pass it along with the intent you invoke the Service with (it's parcelable), then when your task completes in the Service, you call the ResultReceiver's onReceiveResult() method with the results.

like image 128
Zsombor Erdődy-Nagy Avatar answered Jan 03 '23 01:01

Zsombor Erdődy-Nagy