[FREE] Pushy Extension (Updated)

UPDATED
21/03/2026
Now You can use Foreground Service to receive your notification even when the app is closed

Hello everyone,
This extension provides full integration with Pushy.me push notification service. It includes device registration, custom notification icons, notification handling, sending notifications, and Pub/Sub functionality.
Before tu use the extension You have to register to Pushy.me website.
Create a new app,
add an App Name
on Android Package Name write the Your app package name
ex: appinventor.ai_yourAppInventorUserName.yourAppInventorAppName
and the Create.
In the Pushy Dashboard you find your ApiKey to use in your App with the extension.

Enable Foreground Service so You can receive notification from Pushy even Your app is closed.
Use Foreground or set your battery to manual for your app.
Add this on Screen1.Initialize

Register
Registers the device with Pushy.me to receive push notifications.

isBatteryOptimizationIgnored
true Optimization Ignored
false Optimization not Ignored
Used to check the optimization status,

OpenAppSetting
Open app settings so the user can set battery optimization to manual, use a notifier to ask to the user if he want to go to settings or not (check the aia sample)
Set the the battery optimization to manual to ensure reliable notification delivery when the app is closed.
You can use the battery optimization or the Foreground Service

SetSmallIcon
Sets the small icon displayed in the status bar.
Available Icons:

  • "info" or "notification" - Information circle
  • "alert" or "warning" or "error" - Warning triangle
  • "email" or "mail" or "message" - Email envelope

SetLargeIcon
Sets the large icon displayed in the expanded notification.
• filePath (string) - Path to image file
Files uploaded to App Inventor Media (e.g., "logo.png")

ClearLargeIcon
Removes the large icon from notifications.

GetNotificationById
Get the NotificationId to manage the notification data

GetNotificationData
Get the Notification Data then You use a JsonTextDecode to extract the data, check the sample project.

Parameters:

  • notificationId (string) - a unique Id to manage different notifications

ClearNotificationById

Clear a notification in the status bar (not opened notification)

Parameters:

  • notificationId (string) - a unique Id to manage different notifications

ClearNotificationData

Clear the notification data

Parameters:

  • notificationId (string) - a unique Id to manage different notifications

Sends a push notification to a single device.

Parameters:

  • apiKey (string) - Your Pushy.me Secret API Key
  • deviceToken (string) - Target device token
  • title (string) - Notification title
  • message (string) - Notification message
  • notificationId (string) - a unique Id to manage different notifications
  • dataJson (string) - Additional JSON data (use "" if not needed)

Sends a push notification to multiple devices.

Parameters:

  • apiKey (string) - Your Pushy.me Secret API Key
  • deviceTokens (string) - Comma-separated device tokens (e.g., "token1,token2,token3")
  • title (string) - Notification title
  • message (string) - Notification message
  • notificationId (string) - a unique Id to manage different notifications
  • dataJson (string) - Additional JSON data (use "" if not needed)

Sends a push notification to all devices subscribed to a topic.

Parameters:

  • apiKey (string) - Your Pushy.me Secret API Key
  • topic (string) - Topic name
  • title (string) - Notification title
  • message (string) - Notification message
  • notificationId (string) - a unique Id to manage different notifications
  • dataJson (string) - Additional JSON data (use "" if not needed)


Subscribes a device to a topic to receive notifications sent to that topic.

Parameters:

  • apiKey (string) - Your Pushy.me Secret API Key
  • deviceToken (string) - Device token to subscribe
  • topic (string) - Topic name


Unsubscribes a device from a topic.

Parameters:

  • apiKey (string) - Your Pushy.me Secret API Key
  • deviceToken (string) - Device token to unsubscribe
  • topic (string) - Topic name


Checks if a device is currently online.

Parameters:

  • apiKey (string) - Your Pushy.me Secret API Key
  • deviceToken (string) - Device token to check


Gets the list of device tokens subscribed to a topic.

Parameters:

  • apiKey (string) - Your Pushy.me Secret API Key
  • topic (string) - Topic name


Called when device registration succeeds.

Parameters:

  • token (string) - The device token


Called when device registration fails.

Parameters:

  • error (string) - Error message


Called when a notification is sent successfully.

Parameters:

  • success (boolean) - Always true for this event
  • messageId (string) - Unique message ID from Pushy


Called when sending a notification fails.

Parameters:

  • error (string) - Error message


Called when a device is subscribed to a topic.

Parameters:

  • success (boolean) - True if successful, false if failed
  • topic (string) - Topic name


Called when a device is unsubscribed from a topic.

Parameters:

  • success (boolean) - True if successful, false if failed
  • topic (string) - Topic name


Called when device presence information is received.

Parameters:

  • isOnline (boolean) - True if device is currently online
  • lastActive (long) - Unix timestamp in milliseconds of last activity


Called when the list of topic subscribers is received.

Parameters:

  • subscribers (string) - JSON array of device tokens


Called when a Pub/Sub operation fails.

Parameters:

  • error (string) - Error message

Extension

com.pushy.aix (2.3 MB)

Project sample:

PushyApp.aia (2.3 MB)

If You use this sample the package name to write in the pushy dashboard is:
appinventor.ai_mpbejo.PushyApp

in the pushy dashboard You can send notifications to test your app remember in the NOTIFICATION DATA write:
{
"title": "Your Title",
"message": "Your Message!",
"notificationId": "1234567890"
}

To test your app You have to install in your device, and remember to check the notification enable e battery optimization set manually in the app android settings, to receive notifications when the app is closed or the smartphone is standby

I hope You find useful.

Best Regards

Marco

6 Likes

"Use of REQUEST_IGNORE_BATTERY_OPTIMIZATIONS violates the Play Store Content Policy regarding acceptable use cases.“

2 Likes

RequestIgnoreBatteryOptimization removed

1 Like

Hi, Accoding to this article, there are 3 ways to keep Pushy Services running continuously in the background. And you chose the second option, which involves disabling battery optimizations. So, I have two question.

  1. Did you try first option which is FCM high-priority fallback delivery. If yes, Did it work?
  2. Are you considering trying the third option using foreground service functionality? ChatGPT mentioned it’s possible to create ultra-minimal notifications, though I haven’t tested this yet. Even if that weren’t the case, what if there were two versions of the extension for users to choose from?

Hi @Numan74,
I tried the way You mentioned, but with no luck.
FCM for me it was a nightmare, every time there was different errors and new libraries to add into the extension, and then you have to consider that you have create a firebase account and follow several steps to enable the FCM fallback.
Also I tried the foreground service but the result was a freeze app, surely I wrong something but at this moment I don’t have the time to investigate.
Maybe in the next future.

Best Regards
Marco

Thank you for your reply. I had high hopes for FCM.:pensive_face:

But FCM doesn't need to function perfectly. It is sufficient to facilitate the receipt of notification Otherwise, there would be no need for Pushy. Are you getting error while building aix?

Added Foreground Service to receive push notification even when the app is closed.

1 Like

Has the visibility of Foreground Service notification been reduced?

No, it depends on Android not on the extension. For me the best way remains to manage the battery manually

Wow it worked really fast. for a little project is perfect. i had to build an apk and use an online apk analizer to get the correct package name to create the app in the pushy website.

but after that its really simple i made a button to register the phone and then get the token number to see it was correclty configured.

im playing with it right now.

Thanks @mocaszcin :waving_hand:t2:

1 Like