-3

I want my app's music to turn off when user turn off the screen. I bet there is a very simple line of code to achieve this, but I haven't found it yet. Please help me, have a good day :)

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Old York
  • 73
  • 1
  • 9

1 Answers1

2

Override OnPause() method of your activity. And, stop your music here like mediaPlayer.stop();.