开发者

How to get the duration of call started from your app?

In my app, when开发者_开发问答 someone clicks on a button, a phone call is started. Can i detect when the phone call is finished, so i will be able to measure the duration of this call?

Tnx.


For call start, use a BroadcastReceiver for the Intent with action android.intent.action.NEW_OUTGOING_CALL. For the call end you want to use a BroadcastReceiver for the Intent with action android.intent.action.PHONE_STATE. The Intent you receive will have an extra, TelephonyManager.EXTRA_STATE, with value TelephonyManager.EXTRA_STATE_IDLE when the call ends. You can then setup your interval timer values and track the duration.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜