New Notification to status bar extension


#1

Hi. I’ve made this extension according to my need to have notifications sent by my app itself, without needing an external operator or service.
So here it is.
You can send notifications with app running in foreground or background , you can choose three styles of notifications (a simple row, a long multi-rows text, multiple messages queued in a single notification).
Every notification has its own id. , so a new one pushed do not cancel a previous one.
The notification can be delayed for some seconds or set at a fixed future time, in format hour and minute, making it easily repeatable.
The blocks are quite self-explanatory about their functions. I hope it would be useful.

New files with a bug fixed
com.tiziano1960.Notifications.aix (16.7 KB)

How it works:
SetStyle - here you can set the desired style of notification as follow (need a string with one of values below)

1 - simple one row notification (string is truncated if it exceeds one row length limitation);only first item of a list of strings is considered

2 - multiple rows notification (longest string are fully shown ); only first item of a list of strings is considered

3 - multiple messages notification, a list of messages is queued and shown in a single notification

SetDelay - here you can set delay for notifications (need a list of strings with two items)

if you want to set an absolute delay it must be in seconds, indicated in the first item, while the second item has a zero in.
Example of delay of 150 seconds (“150”,“0”)

if you want to set a relative delay it must indicate the hour and minute at which the notification has to be sent. In this case the first list item has a zero in and second the time desired in format HH:MM
Example of execution at 16:45 (“0”,“16:45”)

Notify
title parameter needs a string with notification title
yourMsgList parameter needs a string list with your messages to show (with style 1 and 2 only the first message is relevant)
startValueText param. needs a string null or with a text to pass to Screen1 of your activity when it restarts
isDelayed param. needs true/false values if you desire or not to delay your notifications (if true the delay is that one set by SetDelay property)

SendBackThisApp
simply hides the app from view

example of use of blocks


#2

thank you for your contribution!

Remember the naming conventions, which is UpperCamelCase for property, method and event names (i.e. the first letter should be a capital letter) and lowerCamelCase for parameter names
Unbenannt

Taifun


#3

Very nice extension, @Tiziano1960… Will try it today.

The notification can be delayed for some seconds or set at a fixed future time, in format hour and minute, making it easily repeatable.

So, the delay is in seconds? How do format works? hh:mm:ss?


#4

I have tried your extension but unfortunately i always received an error.
When i click a button to attempt the push, the app closed and an error message show up.
This is my block.

image

This is the error message.


#5

The delay must be set as follow, I thought the explication in block was clear enough but I should improve it,:
If you want delay the notification for e.g. 60 seconds set a list for property SetDelay (“60”,“0”). If you want to send notification at e.g. 18:15 the list should be (“0”,“18:15”).


#6

Have you properly set delay and style? In your block unfortunately is not visible . Remember that maximum is 5 items in a message with SetStyle = 3. Please, let me know.


#7

Arghh… I made a little mistake on style 3, so I attach now the correct aix file in first post. Please excuse me.


#8

Is it possible to use the icon of my application?


#9

Update.
Now the notifications show info icon in status bar and your app icon in notification field. Be advised that in Companion shows Companion icon

com.tiziano1960.Notifications.aix (18.0 KB)


#10

And this can work in background ?


#11

As long as app Inventor platform doesn’t have background service, no extension would run in background.


#12

I nake some test before few days.
If using clock component and put sound in it. Is working even is background


#13

For a background working you should better use my New improved notification extension, you can find it in this community in another topic. It less detailed as notification style but I would soon put hands on it, to improve this aspect.