App Inventor Extensions


Phone State Listener Extension

See the App Inventor Extensions document about how to use an App Inventor Extension.

For questions about this extension or bug reports please start a new thread in the App Inventor community. Thank you.

For feature requests please contact me by email. To be a sponsor of a new method already is possible starting from only 10 USD! With your contribution you will help the complete App Inventor community. Thank you.

Oct 7th, 2025: Version 1: initial version.

Description

Phone State Listener Extension to listen to phone state changes of your device. Also of course works if your app is not running and also survives a reboot of the device. The itoox-wrapper library from Kumaraswamy is used, which helps to directly invoke Itoo (if present) to call procedures from the background.
Required permissions: android.permission.READ_PHONE_STATE, android.permission.READ_CALL_LOG

Properties


Dummy property to display the action helper blocks. The action helper blocks can be used in the OnReceive event handler.


Reference screen for Itoo where the procedure 'OnReceive' exist. It is advised to set the Reference screen property before Starting the service initially. Or if no property is set, the extension will take "Screen1" as the reference by default.

OnReceive has the arguments action, number, start and end.

Methods


Ask for permissions android.permission.READ_PHONE_STATE and android.permission.READ_CALL_LOG


Returns true, if permissions have been granted, else false.

Example App "Phone State Listener Test"

In the example app the phone state listener extension stores all phone state changed events using the itoo StoreProperty method and displays the log after starting the app.



Test

Tested successfully on Samsung Galaxy A54 running on Android 15.

For questions about App Inventor,
please ask in the App Inventor community.Thank you.

Download


Developing and maintaining snippets, tutorials and extensions for App Inventor takes a lot of time.
I hope it saved some of your time. If yes, then you might consider to donate a small amount!

Donation amount:

or donate some mBTC to Bitcoin Address:
1Jd8kXLHu2Vkuhi15TWHiQm4uE9AGPYxi8
Bitcoin

Thank you! Taifun
 

Download TaifunPhoneStateListener extension (aix file
Download Phone State Listener Test project (aia file)
Back to top of page ...

Creative Commons License
This work by Pura Vida Apps is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
with attribution (name=Pura Vida Apps and link to the source site) required.

Back to top of page ...


Home | Snippets | Tutorials | Extensions | Links | Search | Privacy Policy | Contact