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?!!!
Asked
Active
Viewed 111 times
0
-
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 Answers
0
You'll need to create a service, because activities don't run when screen is off

user3365436
- 13
- 3
-
but the problem is that it is not possible to detect key presses from services ! – Soheil Jul 30 '14 at 14:32