music pause when app killed when using service

后端 未结 3 1624
無奈伤痛
無奈伤痛 2021-01-29 00:57

I am using a Service class to play music in the background. While I am displaying the notification bar on top, there is issue in my app. When I kill the app, the mu

3条回答
  •  误落风尘
    2021-01-29 01:15

    That tutorial shows you how to build a BACKGROUND service, which can get killed by the system. To play music you should use a FOREGROUND service.

    https://developer.android.com/guide/components/services.html#Foreground

提交回复
热议问题