Firebase Plugin usage example for Android

Hi,

We are trying to configure Firebase plugin for Android to get Firebase Token register callbacks.

We added the next code in the DefaultEngine.ini file to enable Firebase service and override the FirebaseService class by our custom inherited FirebaseMessagingService:

[/Firebase] FirebaseEnabled=True FirebaseDisableAutoInit=False FirebaseService=com.<our_company_name>.<module_name>.<our_company_name>FirebaseMessagingServiceOur custom FirebaseMessagingService is built on a custom uplugin and looks like this:

`package com.<our_company_name>.<module_name>;

import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.google.firebase.messaging.FirebaseMessagingService;
import android.util.Log;

class <our_company_name>FirebaseMessagingService extends FirebaseMessagingService
{
@Override
public void onNewToken(@NonNull String firebaseToken) {
Log.d(“<our_company_name>FirebaseMessagingService”, “Refreshed Firebase token: " + firebaseToken);
if (TextUtils.isEmpty(firebaseToken)) {
Log.e(”<our_company_name>FirebaseMessagingService", “Firebase token is empty or null”);
} else {
onNewPushToken(firebaseToken);
}
}

private native void onNewPushToken(String token);
}`We also added the Firebase plugin in our custom plugin Build.cs PrivateIncludePathModuleNames.

We hecked the gradle project in Intermediate folder and the Firebase Service is not added to the Manifestfile.

We searched for examples about the Firebase plugin usage in the Engine source code, Lyra and github; but we did not find any example.

Is there any example or guidance you could provide to fix this issue?

Thanks,

Xavi

Hi Xavier,

The main issue I am seeing is that the section in your DefaultConfig.ini doesn’t have the name expected by the Firebase plugin:

[/Firebase]should be

[Firebase]without the /. This should ensure that your manifest is properly generated and remove the need to hack intermediate files. The rest of your setup looks correct.

Best regards.

Thanks