


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.
Jul 3th, 2024: Version 1: initial version.
Apr 24th, 2025:
Version 2: Send Sms functionality and OnReceive background event handler added to forward received SMS
SMS Receiver extension.
Use this extension to receive SMS while your app is not running. The including background functionality in Version 2 offers to forward received SMS by sending it to another number or forwarding it by email, etc.
You have 4 different possibilities to trigger an action after an SMS has received depending on property StartMode
Note: Displaying an app above the lockscreen (also known as full screen intent) requires for Android 14+ devices additionally full screen intent permission. After each app update this permission needs to be refreshed again! Its use is restricted: For apps targeting Android 14 (API level 34) or higher, apps that are allowed to use this permission are limited to those that provide calling and alarms only. You can use method HasFullScreenIntentPermission to check if your app has the permission; if not or if your app has not been approved for default enabling use of full screen intents you can use method AskForFullScreenIntentPermission to launch the settings page where users can grant the permission.
Required permissions: android.permission.RECEIVE_SMS, android.permission.SYSTEM_ALERT_WINDOW, android.permission.POST_NOTIFICATIONS,
android.permission.DISABLE_KEYGUARD, android.permission.WAKE_LOCK, android.permission.USE_FULL_SCREEN_INTENT
In version 2 android.permission.SEND_SMS has been added to forward received sms to another number.
Note: To publish an app in Google Play using the sensitive permission RECEIVE_SMS or SEND_SMS might be a challenge. You have to find a good use case, see also here.
Reference screen for Itoo where the procedure 'OnReceive' exists. If no property is set, the extension will take "Screen1" as the reference by default.
OnReceive has the arguments phoneNumber and message.
Note: The OnReceive event handler also will be called if the app is in the foreground!
Returns/Specifies the notification color.
Returns/Specifies the SmallIcon for notification. Recommended size is 96x96.
StartMode after SMS has been received.
Possible values are: 1, 2,3 or 4. (1 = Only notification, 2 = Start Above Lock Screen or Notification, 3 = Start Always,
4 = Only Background Processing).
Returns true, if receive sms permission has been granted, else false.
Returns true, if send sms permission has been granted, else false.
Ask for both RECIVE_SMS and SEND_SMS permissions.
Returns true, if post notifications permission has been granted, else false. Required starting from API Level 33.
Ask for Post Notifications permission. Required starting from API Level 33.
If user likes to always start the app, special permission is required. Using this method, you can check, if the permission has been granted.
Open Appear On Top Settings to enable always starting the app. Required starting from API Level 23.
Returns true, if full screen intent permission has been granted, else false. Required starting from API Level 34.
Ask for Full Screen Intent permission. Required starting from API Level 34 for apps that did not complete the Google Play declaration
or have not been approved for default enabling use of full screen intents.
Cancel the current notification.
Sends a text message via SMS.
Event indicating that sms has been sent.
Blocks Screen1
Blocks LockScreen
Screenshots
The example app gives a short overview about its purpose and asks for 2 basic permissions to receive sms and post notifications
Depending on the start mode, further permissions are required. Both Start Modes "Start Above Lock Screen or Notification" and "Start Always" require Full Screen Alert permission. Start Mode "Start Always" requires Allways On Top permission.
Itoo
is a powerful framework to execute blocks in the background. Version 2 of the sms-receiver extension uses the
itoox-wrapper library
and provides the new OnReceive event handler (which looks like a procedure). By default the event handler is located in Screen1.
But you can set the property ReferenceScreen (see documentation below) to use the event hanlder on a different screen.
The background event handler will be called from Itoo from the background after an a SMS has been received.
You will have to create the procedure using the name OnReceive.
That procedure must have 2 arguments, else it will not work. Note: This background event handler also will be called if the app is in the foreground.
Now we can execute almost any synchronous logic in the background (no user interface components) after a sms has been received.
This currently is restricted to synchronous methods, i.e. methods which return something in an event (for example the web component) will not work.
Please be aware, that there is no user interface available in the background.
Preconditions for using the OnReceive event handler together with Itoo
Guidelines for using Itoo
The example uses my mail extension to send the email. This extension can be purchased seperately here.
Tested successfully on Samsung Galaxy A54 running Android 14 and Google Nexus 5X running Android 8.1.
You can buy this extension (aix file).
With your payment you accept the
terms and conditions below.
Payment options
Then send me the transaction id by email and
tell me the extension you are interested in.
After having received your payment I will be happy to send the download link to you. Please let me know your Google account!
I usually will send the download link not later than 24 hours after having received your payment.
Thank you! Taifun
After buying the extension you additionally will receive the following projects