How to pass a value in Services?

前端 未结 2 1115
清酒与你
清酒与你 2021-01-16 19:55

I am making a media player ,who can run in background. i have to send a string uri in this service. but i cant send the uri value from my activity through bundle.Services cl

2条回答
  •  醉话见心
    2021-01-16 20:19

    You should use IntentService http://developer.android.com/reference/android/app/IntentService.html.

    Implement onHandleIntent(Intent intent) which will be called each time you start service with the startService(intent). You can pass your data to service through this intent.

提交回复
热议问题