Jazzy Loh
Jazzy Loh

Reputation: 1

How to send a notification to an Android App that the User has manually changed the Volume Control Keys?

I am trying to work out a solution here. I am currently developing an App that streams live recordings. If the User manually changes the Volume Control Keys, I would like this change to notify the App and reflect/update this change on the Virtual Volume Slider Bar in the App?

Upvotes: 0

Views: 187

Answers (1)

Samuel
Samuel

Reputation: 4387

I would probobally do this:

public boolean onKeyDown(int keyCode, KeyEvent event)  
{  
   if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode ==KeyEvent.KEYCODE_VOLUME_UP) {  
       //get the cur volume, set your on screen to this volume
   } else { 
       return super.onKeyDown(keyCode, event);  
   } 
} 

Upvotes: 1

Related Questions