如何让我的Android应用程序检测掉话? [英] How can my android app detect a dropped call?
问题描述
我写的是指通话过程中运行的应用程序。在用户进行呼叫,并开始我的应用程序,我想我的应用程序才能够知道呼叫来自接触不良下降。这可能吗?谢谢
I am writing an app that is meant to be run during a call. After the user makes a call, and starts my app, I want my app to be able to know if the call is dropped from bad connection. Is this possible? Thanks
推荐答案
Android的 TelephonyManager
类提供了 getCallState()
方法,它会告诉你当前呼叫的状态。你会寻找一个过渡,从 CALL_STATE_OFFHOOK
到 CALL_STATE_IDLE
。
The Android TelephonyManager
class provides the getCallState()
method, which will tell you the status of the current call. You'll be looking for a transition from CALL_STATE_OFFHOOK
to CALL_STATE_IDLE
.
不幸的是,我看不出有什么方法来注册一个回调,所以你可能不得不求助于投票。
Unfortunately, I don't see any methods in there to register a callback, so you may have to resort to polling.
的http://developer.android.com/reference/android/telephony/TelephonyManager.html
这篇关于如何让我的Android应用程序检测掉话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!