Android Question Outgoing Call Duration

CapReed

Member
Licensed User
Longtime User
Good morning

I am creating an application to control phone calls. To know how the call lasted, establish a process to have in mind the OFFHOOK + IDLE. But I have a little problem, as it begins to run from me I pick to establish the call, when it really should count the time from when the person to accept the call.

Is there any way to control when the person to whom my call pick up your phone?

Many thanks!

P.D. Excuse my bad english ...:(
 

bsnqt

Active Member
Licensed User
Longtime User
I really want to know if we can, but AFAIK unfortunately so far we cannot know this...
 
Upvote 0

CapReed

Member
Licensed User
Longtime User
I really want to know if we can, but AFAIK unfortunately so far we cannot know this...

:confused:

I have it solved by a little sloppy. I think a service that runs on 20 seconds and you are looking for the call in the Call Log and takes the right time. It is a solution somewhat problematic if a few calls together. I understand that if the Call Log saves the time correctly, there must be some way that we can also take control of that situation.

Thank you very much for your quick response!
 
Upvote 0

bsnqt

Active Member
Licensed User
Longtime User
Thanks for sharing, it is very interesting and smart workaround.

Actually I am not sure whether I understand correctly your question as well as your solution. In my knowledge (as I am also working on a project that is related to CallLog), the call log item of the CURRENT CALL is added by system only *after* the call has been ended. It is *not* created when the call receiver (at the other end) picks up the call. If you have 2 phones, you can see this easily by calling from one to another and check the call log. That is why, to delete a call log item (there are many apps that help to clear call logs to keep privacy), normally you have to *wait* few seconds after the call ends up (IDLE). I can be sure about it, as I spent several days to solve this: in the beginning I did not know, so we tried to clear the log item too fast - right after the call ends - so it failed, finally we have to pause the deleting process for few seconds, and it works.
 
Last edited:
Upvote 0

CapReed

Member
Licensed User
Longtime User
That is correct @bsnqt. According to my tests, the time required for the call is saved in the Call Log is about 10 seconds, so I give him 20 seconds. What I do is use

StartServiceAt (UpdateDuration, DateTime.Now +20 * 1000, True)

to run a service that is responsible for finding the last call in the Call Log and return the time you registered.

But the problem comes when two or more calls are made consecutively, especially if you make the same number. This is not very likely, but I'm a little maniac for details.

I hope I have clarified the question a little more. (I hate the damn English ;))

Thank you!
 
Upvote 0
Top