How to implement callbacks using IntentService on Android?

后端 未结 2 1510
一生所求
一生所求 2021-01-14 01:09

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

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

相关标签:
2条回答
  • 2021-01-14 02:10

    checkout this post :Using ResultReceiver in Android , discussing the implementation of resutlreceiver.

    0 讨论(0)
  • 2021-01-14 02:15

    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.

    0 讨论(0)
提交回复
热议问题