Push notifications
With this plugin you can also manage the push notification section of MBurger, this is a wrapper around MPush, the underlying platform, so you should refer to the MPush documentation to understand the concepts and to start the push integration. In order to use MBMessages
instead of MPush
you have to do the following changes:
Set the push token like this:
Configure the callbacks and Android native interface like this:
To configure the Android part you need to pass a MPAndroidNotificationsSettings
to the configure sections, it has 2 parameters:
channelId
: the id of the channelchannelName
: the name for the channelchannelDescription
: the description for the channelicon
: the default icon for the notification, in the example application the icon is in the res folder as a mipmap, so it's adressed as@mipmap/icon_notif
, iff the icon is a drawable use@drawable/icon_notif
.
Request a token
To request a notification token you need to do the following things:
Set a callback that will be called once the token is received correctly from APNS/FCM
Request the token using MPush:
Register to topics
Once you have a notification token you can register this device to push notifications and register to topics:
The topic are instances of the MPTopic
class which has 3 properties:
code
: the id of the topic[Optional]
title
: the readable title of the topic that will be displayed in the dashboard, if this is not set it will be equal tocode
.[Optional]
single
: if this topic represents a single device or a group of devices, by defaultfalse
.
MBurger topics
MBurger has 2 default topics that you should use in order to guarantee the correct functionality of the engagement platform:
MBMessages.projectPushTopic()
: this topic represents all devices registred to push notifications for this projectMBMessages.devicePushTopic()
: this topic represents the current device
Launch notification
If the application was launched from a notification you can retrieve the data of the notification like this, this will be null
if the application was launched normally:
Last updated