
- (voID)vIEwWillAppear:(BOol)animated { AVAudioSession* audioSession = [AVAudioSession sharedInstance]; [audioSession setActive:YES error:nil]; [audioSession addobserver:self forKeyPath:@"outputVolume" options:0 context:nil]; } -(voID) observeValueForKeyPath:(Nsstring *)keyPath ofObject:(ID)object change:(NSDictionary *)change context:(voID *)context { if ([keyPath isEqual:@"outputVolume"]) { NSLog(@"volume changed"); } } 和AndroID.
@OverrIDepublic boolean dispatchKeyEvent(KeyEvent event) { int action = event.getAction(); int keyCode = event.getKeyCode(); switch (keyCode) { case KeyEvent.KEYCODE_VolUME_UP: if (action == KeyEvent.ACTION_DOWN) { //Todo } return true; case KeyEvent.KEYCODE_VolUME_DOWN: if (action == KeyEvent.ACTION_DOWN) { //Todo } return true; default: return super.dispatchKeyEvent(event); } } 总结 以上是内存溢出为你收集整理的android – React native:捕捉音量按钮按下(不用于音量调节)全部内容,希望文章能够帮你解决android – React native:捕捉音量按钮按下(不用于音量调节)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)