0

I'm developing an Android music player and so my app should be able to detect volume key presses even when no Activity of my app is open and the screen is off(a background service is playing the media). I was thinking that it seems crystal clear that i should detect volume key presses from my service but as I searched the net, I got that it is impossible(e.g. as described here). so what should I do?!!!

Community
  • 1
  • 1
Soheil
  • 1,676
  • 7
  • 34
  • 65
  • It's better to listen to any change in the volume, not only the changes through the buttons. Take a look at this. It explains how: http://forum.xda-developers.com/showthread.php?t=1226792 – luanjot Jul 30 '14 at 14:11
  • @Soheil you have to use services and broadcastrecievers – Akshay Mukadam Jul 30 '14 at 15:21

2 Answers2

0

You'll need to create a service, because activities don't run when screen is off

0

You need to run player in service. Also, you must set media type as music.

QArea
  • 4,955
  • 1
  • 12
  • 22