• Post Reply Bookmark Topic Watch Topic
  • New Topic

Detect volume keys when screen is turned off

 
Rohit Savant
Greenhorn
Posts: 21
Fedora Java ME Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to perform some action when I press the volume keys. I can listen to them when the screen is on. However I also want to listen to them when the screen is turned off as well. I tried using wakelock, but it didnt work. Is there any way to get this done? Please let me know.
Thakyou for your support in advance. !
 
Ron McLeod
Saloon Keeper
Posts: 1289
149
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Activities don't run when the screen is off -- you will need to put that functionality in to a Service component instead.

http://developer.android.com/reference/android/app/Service.html
 
Rohit Savant
Greenhorn
Posts: 21
Fedora Java ME Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. Thankyou. I will try it and will let you know whether it workedm for me.
 
It's exactly the same and completely different as this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!