How to calculate the phone call time?



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!


You can use cordova for this, look at :

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

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


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.