Chintan Soni
Chintan Soni

Reputation: 25287

android: fcm in library module

I am facing a weird issue integrating Firebase Cloud Messaging in a library module. I am working on a library project in which I need to handle notifications right coming from the FCM Server from the library itself. I am not aware if it is possible or not.

Steps I followed:

Problem: When I try to send push from Firebase Console, I am not receiving any Notification.

Have anyone faced such issue and could help me with this ?

Upvotes: 9

Views: 3835

Answers (3)

Chintan Soni
Chintan Soni

Reputation: 25287

So, after running a lot through trial and error method, I succeeded in getting Notifications.

Things to be noted:

  • You cannot just integrate Firebase Cloud Notifications in library module.
  • Client app module who will be using this library module will have google-services.json file in his directory and not in library module directory.
  • Client app module gradle will be having below line in it and not in library module gradle:

apply plugin: 'com.google.gms.google-services'

So, once I made those two changes, I was able to get Notifications.

Upvotes: 14

Vishwa Pratap
Vishwa Pratap

Reputation: 382

Integrating FCM using Android Studio is very easy, You have to only , Tool->>Firebase->>on the Right panel ->>Choose cloud Messaging. Setup-->Firebase cloud messaging.

Then you have to follow point number 1,2,3. And you have to also register your app to Firebase console also as you already status.

Upvotes: -1

RAJESH KUMAR ARUMUGAM
RAJESH KUMAR ARUMUGAM

Reputation: 1570

FCM clients require devices running Android 2.3 or higher that also have the Google Play Store app installed, or an emulator running Android 2.3 with Google APIs.

If you are Using an Emulator Please Check whether Google APIs were installed or Not.

Upvotes: 0

Related Questions