Please tell me how the "phonecall" works for the incoming calls. Tankyou.
There are three events that are available on the PhoneCall component to examine incoming calls.
- PhoneCall.PhoneCallStarted: This event is run when a phone call starts (the line is ringing). The event has a status parameter that will be 1 if the call is an incoming phone call. The phoneNumber parameter will give you the caller’s number.
- PhoneCall.IncomingCallAnswered: This event is run when the user answers the phone call.
- PhoneCall.PhoneCallEnded: This event is run when the phone call ends. The status parameter will be 1 if the call was missed or rejected or 2 if the call was ended after being answered.
Depending on what you want to do, you may need to use one or more of those blocks. Lastly, you won’t be able to test this functionality if you use the companion from the Google Play Store as Google made us remove the functionality. However, the version we publish under App Inventor’s Help > Companion Information screen does include the functionality. Alternatively, you can compile your app every time.
Ok thank you. I’ll try it immediately. Very helpful was your last advice. I’ll tell you about my results.
Now it is working in simulation. Thank you.
But the the block
returns error “The operation Text cannot accept the arguments: , [nothing]”.
I have the same problem
returns error “The operation Text cannot accept the arguments: , [ nothing ]”.
I believe the problem here is that your phone isn’t providing the phone number of the call that just ended. So it is getting a “null” value. This is probably our issue (MIT) to fix, though we would need to figure out what the correct value to supply is. In any event try something like this:
P.S. You should be able to literally drag this image into your blocks editor…
Sorry, but with
I have the error “The operation is text empty? cannot accept the arguments: , [nothing]”
Instead it works with: if get phonenumber = " "
OK. Good to know. Thanks.
It seems that I can’t know the number of an ingoing call. I wanted to send a SMS to a caller after I rejected the call because I was busy: but without his number I can’t send any SMS. Some hint? Thank you.
Which version of Android are you running? I think that on newer versions the app needs to request the permission
READ_PHONE_STATE in order to read the phone number of the incoming caller.
I’ve just checked and indeed we should be requesting the permission. Did you see a prompt for permission when you start the app or add the PhoneCall component in the companion. If not, do you see the permissions in the settings app (Android 6+).
Android version 9.
Please tell me how I can set the permission.
Sorry. Only the if get phonenumber = " " works, but the texting the phoneNumber doesn’t.
It seems that the phoneNumber is NOT = " " but his content is not accepted by text. I don’t know! Tell me about this. Thank you.
Thanks for the additional info @berlioz. We’ll look into replicating this on an Android 9 device and see whether there’s a fix.
I forgot to include my blocks. I’m actually trying to capture the phone number when the call is started. (Looking to create an enhanced caller ID app.)
As with the others, I’m getting the [nothing] error.
Is this a permissions issue? Something else?
I was able to confirm this using an emulator running Android 9. I’m not yet sure what we can do to fix it but at least we can reproduce the issue on our end.
Edit: I have a potential fix:
Awesome, thanks @ewpatton! Any idea how long it usually takes the team to get this into prod? I’m completely new to the project, so I don’t really have any idea what to expect.
@dhelland We’re aiming for the next companion release to be at the end of the month. If you’re not already subscribed to the announcement category, you should do so as we will let people know when we update the test server with new features.
The proposed fix is now up on ai2-test. Please see @jis’s post here:
I have tested successfully sending a predefined text message in response to a missed phone call automatically without having to touch phone using the latest app companion version 256 1 tu. Declining the request of play protect. Thanks MIT team.