Should onHandleIntent be called when IntentService is started with bindService?

ぐ巨炮叔叔 提交于 2019-12-04 10:49:06

Should onHandleIntent be called when IntentService is started with bindService?

No.

Is startService the only way IntentService should be started?

IMHO, yes. IMHO, IntentService is not designed for the binding pattern.

In your case, you can:

  • Pass a Messenger from the activity in an Intent extra in the command sent by startService(), or
  • Use LocalBroadcastManager, or
  • Use Otto, or
  • Use an ordered broadcast, if the IntentService might continue past the activity's life and you want to, say, display a Notification when the work gets done in that case,
  • Etc.

You must call both startService and bindService. This was worked for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!