I'm trying to subscribe to an FCM (Firebase Cloud Messaging) topic for a secondary Firebase App and according to the documentation this could be done by the overloaded getInstance which takes the secondary FirebaseApp instance as a parameter:
public static synchronized FirebaseMessaging getInstance (FirebaseApp app)
Gets the FirebaseMessaging instance for the specified FirebaseApp.
I'm using Kotlin and I'm pulling in the package in build.gradle like this:
implementation "com.google.firebase:firebase-messaging:20.2.0"
But when I try to instantiate the FirebaseMessaging with the overloaded getInstance, I get an error stating that it's not accessible. When I look at the package source, the decompilation shows that the overloaded constructor is not public like the parameterless getInstance:
public class FirebaseMessaging {
public static final String INSTANCE_ID_SCOPE = "FCM";
private final Context zzb;
private final FirebaseInstanceId zzc;
private final Task<zzab> zzd;
@Nullable
@SuppressLint({"FirebaseUnknownNullness"})
@VisibleForTesting
static TransportFactory zza;
@NonNull
public static synchronized FirebaseMessaging getInstance() {
return getInstance(FirebaseApp.getInstance());
}
@Keep
@NonNull
static synchronized FirebaseMessaging getInstance(@NonNull FirebaseApp var0) {
return (FirebaseMessaging)var0.get(FirebaseMessaging.class);
}
Did I miss something?