java - How to detect long presses of the volume key in a service? -


i want detect long presses in volume key in service. here options:


a) let user control volume lock screen

i wan't detect if user has held down volume button in service while screen off. tried (for 2 days) doing contentobserver, problem contentobserver detects volume changes, , volume doesn't change when screen off. there way can let user control volume lock screen?


b) detect long press volume button service

how can this? there broadcast receiver's can use while screen off? there way implement dispatchkeyevent in service?

i have seen this, me second answer doesn't work in background. think easiest way option a because have set when user changes volume, can let user control volume lock screen? if not, there else can do?

thanks much,

ruchir


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -