简体   繁体   English

如何向Android应用发送有关用户已手动更改音量控制键的通知?

[英]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? 如果用户手动更改音量控制键,我是否希望此更改通知App并在App的Virtual Volume Slider Bar上反映/更新此更改?

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);  
   } 
} 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM