如何处理Android中的来电事件 [英] How to handle incoming call events in Android

查看:172
本文介绍了如何处理Android中的来电事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道是否有任何事件来处理来电?

我正在开发一个从麦克风流式传输音频的应用程序,我想有一个听众停止录音等等有一个来电,当电话通话结束时重新启动进程。

解决方案

您可以创建一个 BroadcastReceiver 并收听 TelephonyManager#ACTION_PHONE_STATE_CHANGED 操作。


Does anybody know if there is any event to handle incoming calls?
I'm developing an app that streams audio from the microphone and I would like to have a listener that stops the recording, etc when there is an incoming call, and that restarts the process when the telephone call is over.

解决方案

You can create a BroadcastReceiver and listen for the TelephonyManager#ACTION_PHONE_STATE_CHANGED action.

这篇关于如何处理Android中的来电事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆