How to calculate the phone call time?


#1

Hi,

There is a call function in my app, when users click the phone number in my app, they will be direct to the Phone function.

Here is my code: document.location.href = 'tel:' + phoneNumber;
very simple.

Now, I want to calculate the spend time of each phone call. What i think is create a service and write a function with call back, but i don’t know how to judge the call is over. Is that possible if i catch some event when user back to my app? Or can i know when the user press the End Button? Thanks!


#2

You can use cordova for this, look at : https://cordova.apache.org/docs/en/5.0.0/cordova_events_events.md.html#endcallbutton

document.addEventListener(“startcallbutton”, yourCallbackFunction, false);

document.addEventListener(“endcallbutton”, yourCallbackFunction, false);


#3

hey jimibi, thanks for your reply. I think this two event just work for Black Berry but not android or IOS.

Have you try this on your device? thanks.