1. Home
  2. SDK Android
  3. Advanced
  4. Firebase Integration

Firebase Integration

BEAR frontend provides feature to manage application notification. This section explains how to enable this feature in BEAR SDK by linking it to Firebase.

The Firebase integration is handled application side and not inside BEAR SDK. Don’t hesitate to check Firebase instruction for adding Firebase to your application and setup your Firebase cloud messaging client.

For the notifications to work with BEAR SDK, you must provide BEAR with your Firebase legacy server key.

Finally you need to call BearSdk.registerFirebaseToken(String token) with the Firebase token. The Firebase token can be retrieved by overriding the onNewToken(java.lang.String) method of FirebaseMessagingService class:

public class FcmService extends FirebaseMessagingService {

    @Override
    public void onNewToken(String token) {
        super.onNewToken(token);
        if (token != null) {
            BearSdk.getInstance(this).registerFirebaseToken(token);
        }
    }

}

This way the Firebase token will be linked to the device id assigned at BEAR backend. You can retrieve this device id in your application by calling BearSdk.getDeviceId().

Was this article helpful to you? Yes No

How can we help?