šŸ”” MelonNotification ā€¢ Various styled notifications + Itoo

šŸ”” Melon Notification

A rich library of various notification styles along with the combined power of Itoo

šŸ“š Documentation

Image resource

Any image resource provided to this extension may be

  • a full file path
  • an asset name
  • an URL starting with prefix url:
  • an icon from the default Android Drawable collections
    • it must start with the : prefix, for e.g.
      :ic_media_play
    • only resources starting with ic_ are supported.

If you intend to your custom icon, then please ensure

  • the image is atleast 24x24
  • has a transparent background and white foreground

Blocks

CreateChannel

  • Create a notification group with the given name, description and importance.
    id is an internal identifier, name is the text displayed in app settings.
    Channel ā€¢ Android Docs

    • importance
      none 0, minimum 1, low 2, default 3, high 4, max 5
  • If you dont create a channel explicitly, a Default Channel will be created for you.


Build

  • Create a new basic notification outline.
    It does not automatically post a notification, use the Post block.

  • After creating a basic outline (using this block), you can further top up the notification styles using any of BigTextStyle, BigPictureStyle, InboxStyle, MessagingStyle.

  • If the selected style is not supported by the device, it will fallback to default style (no-style).


BigTextStyle

  • For generating large-format notifications that include a lot of text.

BigPictyreStyle

  • For generating large-format notifications that include a large image attachment.
    • largeIcon: an image resource
    • bigPicture: an image resource
    • contentDescription: descripton of the big picture

InboxStyle

  • For generating large-format notifications that include a list of (up to 5) strings.
    • lines: provide a list of messages/lines to be displayed

MessagingStyle

  • For generating large-format notifications that include multiple back-and-forth messages of varying types between any number of people.
    • person: This person's name will be shown when this app's notification is being replied to. Use the CreatePerson block

    • conversationTitle: to set a conversation title for group chats with more than two people.

    • messages: a list of messages created using the CreateMessage


CreatePerson

  • Create a person object with the given details. To be used for the MessagingStyle and CreateMessage block.
    • personId: a unique person identifier
    • uri: optional string, mail or phone of the person, format:
      • A mailto: schema*
      • A tel: schema*

CreateMessage

  • Create a message object with the given details. To be used for the MessagingStyle block.
    • person: the person who sent the message, use the CreatePerson block.
    • timestamp: time in milliseconds
    • historic: check true if this message is for contextual purpose

AddAction

  • Add an action button to the notification that may open the app with a start value or call a procedure through Itoo.

    • intent: action i.e. to be performed after the button is pressed, use the CreateIntent or the CreateItoo intent block
    • isContextual: true if the user's action is based on the notification's content.
    • authRequired: true if device authentication is required to view the message
    • allowGeneratedReplies: a future prospect, check it to false always.
    • showUserInterface: true if the upon clicking, opens an user interface

CreateIntent

  • Create an Intent object as required for the AddAction block or to normally set Notification's click Intent using the Intent block.
    • name: can either be a simple screen name or full activity name you want to open

CreateItooIntent

  • Are you a fan of Itoo? Then this block is for you!
    You can create an Intent that will fire up your procedure even if your app is closed :fire:
    It requires the Itoo extension to be present in your screen.

    • screen: name of the screen where the procedure exists
    • arguments: a list of arguments that'll be used to call the procedure
    • alwaysOnMain: if true, the procedure will be normally called (on U.I) without Itoo only if the the application is active. If false, it will be called as a seperate process (standard background Itoo rules apply)

Post

  • Posts the notification with the given Id. You may also use this to update a notification.
    If id is less than 1, a random Id will be choosen.

Cancel

  • Cancels the given notification Id

CancelAll

  • Cancels all notifications posted

PermissionGranted

  • Can we post notifications? No? AskPermission then!

AskPermission

  • Asks for the notifications permission

Properties

  • ActiveNotificationIds returns a list of notification Ids that are currently active

  • AlertOnce only alerts the user ones, use this to update notifications quitely

  • AutoCancel if the notification should auto cancel upon click

  • CacheImages should extension cache images into memory? True by default.

  • Channel channel name to use for the next notification that'll be posted or updated.

  • Intent use the CreateIntent or the CreateItooIntent block to specify an action that'll take place when the user clicks on the notification.

  • LargeIcon for the notification.

  • ShowTimestamp If you want a timestamp to be shown along the notification to indicate the time when the notification was posted.

  • Subtext for the notification, for additional information, most of the times you dont require it.


šŸ’” Notes

  • ATM, you cannot receive button click events on Companion.
  • CreateItooIntent works only in compiled APK

šŸ§© Extension

The extension is open source under the GPLv3 license.

I'm a 16 year old high school student, I like to create and maintain many extensions. I research a lot daily to bring something new to App Inventor, while also helping others :smiley:

While my primary goal and perspective on App Inventor is not to earn money, it really helps and motivates me a lot if you could spare some donations. :hugs:

Paypal: paypal.me/XomaDev

V1.1 space.themelon.melonnotification.aix (58.8 KB)
Example project featuring all notification styles MlemonNotification.aia (830.3 KB)

A lot more stuff features coming in the future!

Thank you
Kumaraswamy B G

18 Likes

Another excellent extension from you once again. :clap::clap::clap::clap::clap: :heart::fire:

5 Likes

Greate work :heart:

2 Likes

Stright to import the sample and compile it but when i open the app it crashed.

Edit on android 10

1 Like

Hotfix 1.1

  • Fixed bug causing app crash on older Androids
  • Added on Ongoing property block; makes the notification permanent when set to true

Thank you @Clouds_Workshop

4 Likes

When I press the button 1 it should open the UI right ? It doesn't. It only opens the UI when I click the notification.
The showUserInterface is referring to the button right ?

It is just to tell the Android system that whether or not clicking on the action shows the user interface. It does not add any additional functionality on its own.

No! It has been programed to instead start a Itoo procedure in background:

As you can see we are calling createItooIntent. So when you click Button 1, it will change the Label's text to tell you which button has been clicked:

But, if you want clicking on the Button to open up the user interface, then instead of calling the createItooIntent procedure, instead call this block:

Understood. Thanks.

I made the simple Notification call with only one function because if you want to call notifications with different texts every time you need to build all over again using multiple functions.
I suppose something similar can be done for adding buttons in notifications but it's more complicated.

image

1 Like