开发者

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

开发者 https://www.devze.com 2023-04-06 01:01 出处:网络
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?

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

精彩评论

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