Development

Android

To help developers integrate their Android applications with Notify My Android, we added the feature on NMA to broadcast an Intent every time a new notification arrives.

That enables both users and developers to do even more with push notifications, like execute actions when notifications arrive, based on its contents, by having 3rd party applications listening for those Intents.

Intents Broadcasted

Intent Name

com.usk.app.notifymyandroid.NEW_NOTIFICATION

Extras

"app" (String): The name of the application that originated the notification"event" (String): The event that is been notified"desc" (String): The notification text/body"prio" (int): The notification priority"url" (String): The attached URL/URI, if any

Example Code on how to listen/receive these Intent Broadcasts on your app

Listening for Broadcasts with Broadcast Receivers

To create a new Broadcast Receiver, extend the BroadcastReceiver class and override the onReceive event handler as shown in the code below:

Then you need to add the receiver tag below within the application node specifying the class name of the Broadcast Receiver to register. The receiver node needs to include an intent-filter tag that specifies the action string being listened for, as shown in the XML snippet below:

This is a port from the original library by Damien Degois.It includes a command line tool as an example on how to use the python library. You can download the last version of the library or the source code from our GitHub repository.