Dean Blakely
Dean Blakely

Reputation: 3595

Firebase Messaging issue

I’m trying to learn Firebase messaging so that I can migrate my apps (one of which is a chat app) from GCM to FCM.

I’m reading the docs and they tell me, for instance, that if I’m going to use messaging that I must specify .MyFirebaseMessagingService and .MYFirebaseInstanceIDService in my AndroidManifest.xml file. Furthermore I need to migrate my InstanceIDListenerService, maybe my GcmListenerService, and possibly usage of GcmPubSub.

The messaging sample on Github isn’t anything as sophisticated as a chat app – it only shows how to manually send notifications from the firebase console to my app.

However before all of that this first tutorial from Tutorial Point I found and implemented is an actual working chat application. It is very simple and doesn’t use any of that stuff the docs say I have to use. The “chat” module has a simple ChildEventListener that triggers any time a message is sent or received. No messaging servers, no servers at all. It uses Android Volley.

The tutorial point solution seems a fraction of the complexity and code that the formal Firebase docs recommend. What am I missing?

Upvotes: 0

Views: 210

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 600071

It sounds like the tutorial from Tutorial Point uses the Firebase Realtime Database to build a chat application, which is quite different from Firebase Cloud Messaging.

The Realtime Database is mostly used when an app is active, to keep data in the app in sync with a database in the cloud. Chat apps are a great example for this database, since they highlight the API model in an intuitive way.

Firebase Cloud Messaging is used to deliver messages to apps that are both active and inactive, and to display notifications to the user, even when the app is not active.

Since you're migrating from GCM to FCM, the tutorial seems pretty irrelevant. I instead recommend following Migrate a GCM Client App for Android to Firebase Cloud Messaging.

Upvotes: 1

Related Questions