MappPushHelper is a native Android API for applications that own a custom FirebaseMessagingService. It runs without a React Native JavaScript runtime, which makes it the reliable way to forward Mapp push messages and FCM tokens while your application is backgrounded or terminated.
If your application uses the plugin's default Firebase service, you do not need this API. It only applies once you have selected custom push ownership — in Expo, by setting android.pushHandling to "custom"; in React Native CLI, by registering your own FirebaseMessagingService and removing the plugin's default service.
Methods
Method | Purpose | Replaces in a native Firebase service |
|---|---|---|
| Safely engages Mapp on the main looper and waits for the bounded initialization attempt. | Direct background calls to |
| Returns whether a native | Converting the message to JSON and calling |
| Initializes Mapp when needed and forwards a Mapp message. Returns |
|
| Initializes Mapp when needed and forwards a new FCM token. | Calling |
| Waits for the already-engaged SDK to become ready, for a bounded period. | Application-owned polling of |
Usage example
Implement your FirebaseMessagingService and delegate to MappPushHelper:
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.reactlibrary.MappPushHelper;
public final class ApplicationMessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage message) {
if (!MappPushHelper.handleMessage(getApplication(), message)) {
// Handle non-Mapp messages.
}
}
@Override
public void onNewToken(String token) {
MappPushHelper.handleNewToken(getApplication(), token);
}
}Why not the JavaScript methods
Mapp.setRemoteMessage(), Mapp.isPushFromMapp(), and Mapp.setToken() remain supported, but only while JavaScript is guaranteed to be running. They are not reliable while your application is backgrounded or terminated, because there may be no JavaScript runtime available to call into. MappPushHelper runs entirely in native code and has no such dependency.
Note
For the full list of behavior changes in 2.0.0, see Breaking Changes in 2.0.0.