App Inventor Extensions


Simple Notification 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.

Nov 9th, 2015: Version 1 of the Notification Extension released for App Inventor version ai2extensions5 and Companion version 235.cdk1.

Aug 11th, 2016: Version 2a: enable to load icon also from sdcard, avoid DX execution failed error: build each extension separately

Jan 16th, 2017: Version 3: property IgnoreNotification added

Apr 14th, 2017: Version 3a: remove library android-support-v4.jar and use Notification instead of NotificationCompat

This is a simple notification extension and currently only runs on older Android versions, i.e. < Android 8. Therefore my recommendation is to use one of the other available notification extensions, see also here.

You also might be interested in my new Alarm Manager Extension with Notifications, which still works also if your app is not running.

Description

Send a notification in n seconds with the corresponding title and text. After restarting the app, you can get the start text from the 'plain start text' block in App Inventor.
Required permissions: none

Notification Style Options


Notification with default Android information icon


Notification with custom icon (available for Android devices 4.1 or up)


Notification with big picture display (available for Android devices 4.1 or up)

Notes

Properties


Returns whether Notification Sound should be suppressed.


Specifies whether Notification Sound should be suppressed.


Returns whether big picture should be displayed in Notification.


Specifies whether big picture should be displayed in Notification.


Returns Custom Notification Icon.


Specifies Custom Notification Icon.


Returns whether click onto notification should be ignored.


Specifies whether click onto notification should be ignored.
Which means, after setting this property to true it just does not happen anything, if you click onto the notification...

Methods


Move task (i.e. the app) to the background.


Send a notifacation in n seconds with the corresponding title and text. After restarting the app, you can get the start text from the 'plain start text' block in App Inventor.
Parameter:
- seconds = the number of seconds
- title = the title of the notification
- text = the subject of the notification
- startText = the text which is provided after restarting the app in the 'plain start text' block

Send Notification Example App

Send a notifacation in n seconds with the corresponding title and text. After restarting the app, you can get the start text from the 'plain start text' block in App Inventor.


Test

Tested successfully on Nexus 5X running Android 7.1.1, Nexus 5 running Android 6 and Samsung Galaxy Tab 10.1N running Android 4.0.4.

Known Issues

For older Android devices (at least on HTC Desire S running Android 2.3.5) the app could not be terminated before starting it again, which means in this case the start text can't be displayed.

Questions and Answers

Q1: If the application is closed with the home button it works but if it is closed with the back button it doesn't work, can you help me?
A: As workaround just disable the back button, i.e. move an empty Screen.BackPressed event into the working area.

Q2: Is it possible to display the defined icon also in the notification area?

A: In the notification area for the extension it is only possible to display Android Default icons and I have chosen the icon ic_dialog_info. As soon as it is possible to use Android 6 features in extensions, then this could be modified. The icon you specified will be displayed in the notification drawer, see also chapter "notification style options" above.

Q3: When I press the notification on my bar, it opens my Screen1 which is my login screen. How can I change to other than Screen1?
A: set the startText parameter of the Send method to something (for example to "Screen2") and in the Screen.Initalize event add an if statement like this
if get plain start text = "Screen2" then open another screen "Screen2"

Q4: I'm making an app for school and was wondering if I had to give you credit at all in my app for using your notification extension?
A: Why it's a good idea to give credit: How to Cite Sources & Not Steal People's Content on the Internet by Corey Wainwright.

Q5:I have a good idea for your notification extension. I think when people open the app (switch to foreground operation), the message in the notification bar will disappear automatically. Do you think is this feasible?
A: Thank you for the suggestion, however my extension is only "a simple notification extension"... You might want to try the New Improved Notification Extension by Tiziano1960...

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

Terms and Conditions

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 TaifunNotification extension (aix file)
Download Notification Example App (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.


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