You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TL;DR: firebase-admin and firebase-messaging has the same classpath com.google.firebase.messaging.*, but their class's content is totally different.
Currently, I want to use both the module firebase-admin and firebase-messaging to learn about the feature Cloud Messaging, so I have installed my dependencies as above. The issue arose when I wanted to import the class FirebaseMessaging.
// Create a list containing up to 500 registration tokens.// These registration tokens come from the client FCM SDKs.List<String> registrationTokens = Arrays.asList(
"YOUR_REGISTRATION_TOKEN_1",
// ..."YOUR_REGISTRATION_TOKEN_n"
);
MulticastMessagemessage = MulticastMessage.builder()
.putData("score", "850")
.putData("time", "2:45")
.addAllTokens(registrationTokens)
.build();
BatchResponseresponse = FirebaseMessaging.getInstance().sendMulticast(message);
// See the BatchResponse reference documentation// for the contents of response.System.out.println(response.getSuccessCount() + " messages were sent successfully");
It turned out that while the imported class was com.google.firebase.messaging.FirebaseMessaging, the class was from the module firebase-messaging , which did not contain any of useful send method, rather than firebase-admin.
Is there anyway I can import the class FirebaseMessaging from firebase-admin and still keeping the two modules? I had switching the import order in Gradle file but still to no avail.
Thank you very much!
The text was updated successfully, but these errors were encountered:
Environment
This is currently the dependencies used in my app-level Gradle build script
Description
TL;DR:
firebase-admin
andfirebase-messaging
has the same classpathcom.google.firebase.messaging.*
, but their class's content is totally different.Currently, I want to use both the module
firebase-admin
andfirebase-messaging
to learn about the feature Cloud Messaging, so I have installed my dependencies as above. The issue arose when I wanted to import the classFirebaseMessaging
.While I was following [this tutorial] (https://firebase.google.com/docs/cloud-messaging/send-message#send-messages-to-multiple-devices) to build a send request to multiple devices, my IDE could not resolve the method
sendMutlicast()
It turned out that while the imported class was
com.google.firebase.messaging.FirebaseMessaging
, the class was from the modulefirebase-messaging
, which did not contain any of usefulsend
method, rather thanfirebase-admin
.Is there anyway I can import the class
FirebaseMessaging
fromfirebase-admin
and still keeping the two modules? I had switching the import order in Gradle file but still to no avail.Thank you very much!
The text was updated successfully, but these errors were encountered: