I want to write an app that records call duration and send that data to google sheet, i don't know where to start

i want to write an app that records call duration and send that data to google sheet, i don't know where to start

Hello thinh

I suggest you write small test Projects that deal with each specific requirement, then move on to building the App itself.

Test 1) Use the PhoneCall Blocks to make a call to another phone in your household

Test 2) Add a Clock Component plus .PhoneCallStarted and .PhoneCallEnded Blocks to the Test 1 code. In the .PhoneCallStarted Block, record the current time in milliseconds, In the .PhoneCallEnded Block, record the time now in milliseconds, subtract one from the other to get call duration.

Test 3) Add code to the Test 2 code that sends the result to a google sheet, following TimAI2's guide:

Once those basics are working, you can add a ListPicker to call any number stored on the phone, a download Procedure to display the GoogleSheet data in-App etc etc.

1 Like

làm thế nào tôi có thể xuất thời lượng biến = biến bắt đầu - biến kết thúc

Ah, no, you need to record milliseconds or seconds.

There is a Block that returns duration (duration = end - start).

See my website:

Replace the Button Components in the example with the Phone Call Blocks.

thank you, i did it, how can i display the dialed number in the box
Capture 2

Set TextBox.Text to PhoneCall.PhoneNumber.

1 Like

tôi đã làm nó nhưng không có kết quả

thinh, you have to work in seconds or milliseconds - then if required, the result can be converted to hours, minutes, seconds. You can download my working example, try it as-is first, then change the Button Blocks to Phone Blocks.

you have to put the phoneNumber variable returned from the event and not from the property.

1 Like

Hi thinh

Here is a working example. Import the .aia Project file into App Inventor and use Build to make an APK (Scan to your phone).

Tested, works well.

I can't see your .aia file

I can't see your .aia file

ElapsedTimeOfPhoneCall.aia (4.0 KB)

Sorry about that thinh

1 Like

I have done it and it doesn't work, what I need is the calling phone number displayed in the phone number box

When you say "it doesn't work", what are you referring to? What does not work?

You can do that - TextBox on your GUI and the selected phone number can populate it via the .AfterPicking block.

i have done it, however i am not assigning the calling phone number via the phone number box and through the .AfterPicking block like you have done

So that would be why "it dosen't work".