Message Metrics

Using MBMessages gives you also the chanche to collect informations about your user and the push, those will be displyed on the MBurger dashboard. As described in the prervious paragraph, in order for this to function, you need to configure push notification receivement as described below:

The push service must extend MBurgerFBMessagingService instead of FirebaseMessagingService, then implement this method which is a wrapper around the standard onMessageReceived for Firebase:

override fun onMBMessageReceived(remoteMessage: RemoteMessage, intent: Intent) {
}

Then when you create your notification to create the PendingIntent you should use the Intent provided with this function, you can add more extras or set which class you wish to set the Intent.

intent.setClass(applicationContext, MainActivity::class.java)
intent.putExtra("param", some_parameter)

Then when you call the notify method to show the notification call this API:

MBMessagesMetrics.trackShowPush(applicationContext, intent)

Lastly on the activity you use to call from the notification (mainly your android.intent.action.MAIN and android.intent.category.LAUNCHER activity) call this API on the onCreate method:

MBMessagesMetrics.checkOpenedFromPush(applicationContext, getIntent())

Last updated