Notifications

 

Foreword

Push notifications notify the user of new events in an application. Push notifications are generally created when information is sent by the server in communication with the application.

 

Tagging example

To tag push notifications, it’s necessary to have an IntentService class. This class will retrieve information from the server for generation of the application’s push notifications. Thanks to this, parameters can be added to the notification.

Example of code for creating a notification containing information:

This Intent will then be used by the notification.

NB: In order to tag the deletion of a notification, you have to create a specific BroadcastReceiver

In AndroidManifest.xml:

In DismissNotificationReceiver.java:

In the view called during the click on the push notification, it is now possible to retrieve information contained in the notification and therefore tag it.

Example:
We retrieve the notification’s Intent and we verify that the desired data exists:

If you wish to simplify the tagging of your links without having to know the significance of each field, try the interface available in our marketplace. Please note that this interface has been created by our community and can be improved, so feel free to send us your feedback!

Was this post helpful?
Yes
No
Last update: 18/05/2018