# 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](https://mburger.cloud/) 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())
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ep.mburger.cloud/android-docs/messages/untitled.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
