Android Media Player Plays In The Background, But Doesn't Stop When App Killed

后端 未结 10 1930
被撕碎了的回忆
被撕碎了的回忆 2021-01-17 08:15

I\'m new to Android, so I have a problem. In Android I want to play background music as soon as my music player starts and have it continue even if the activity changes from

10条回答
  •  没有蜡笔的小新
    2021-01-17 09:04

    The simplest solution is to go into your Android settings > Apps > (name of your music player), then tap "Force Stop". Confirm the operation, and the music should stop. It may not work with all music players, but it's worth a shot.

    If you must have code, have you tried assigning music.pause()? This command stops the music.

提交回复
热议问题