How to play mp3 continuosly when application starts and stop when user close app in background

后端 未结 4 1721
一整个雨季
一整个雨季 2021-01-26 02:14

I am writing an app in which i am allowing user to view images and select one of them to set an WALLPAPER, and in this i also want to play an mp3 when user starts an App and sto

4条回答
  •  遥遥无期
    2021-01-26 02:54

    create service and put Mp3 start code in OnstartCommand(its a service class method you can override it) and whenever your you want to start mp3 just create Intent object and call StartService method and call StopSerice where you want to stop mp3 in application.

提交回复
热议问题