Services cannot listen for keypresses, but can't they change the volume? Why not have the service periodically check the volume and reset it to max automatically?
Ie, something like:
// Get the AudioManager
AudioManager audioManager =
(AudioManager)this.getSystemService(Context.AUDIO_SERVICE);
// Set the volume of played media to maximum.
audioManager.setStreamVolume (
AudioManager.STREAM_MUSIC,
audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC),
0);
Unless there are more requirements here that I am missing, this sounds achievable without root.
Ie, something like: // Get the AudioManager AudioManager audioManager = (AudioManager)this.getSystemService(Context.AUDIO_SERVICE); // Set the volume of played media to maximum. audioManager.setStreamVolume ( AudioManager.STREAM_MUSIC, audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC), 0);
Unless there are more requirements here that I am missing, this sounds achievable without root.