How can my android app detect a dropped call?

前端 未结 2 809
鱼传尺愫
鱼传尺愫 2020-12-11 03:00

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

2条回答
  •  死守一世寂寞
    2020-12-11 03:19

    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

提交回复
热议问题