[英]android: fcm in library module
I am facing a weird issue integrating Firebase Cloud Messaging in a library module. 我正面临着将Firebase Cloud Messaging集成到库模块中的一个奇怪问题。 I am working on a library project in which I need to handle notifications right coming from the FCM Server from the library itself.
我正在开发一个库项目,我需要从库本身处理来自FCM服务器的通知。 I am not aware if it is possible or not.
我不知道是否可能。
Steps I followed: 我遵循的步骤:
google-services.json
in library module. google-services.json
放入库模块中。 FirebaseInstanceIdService
. FirebaseInstanceIdService
获取生成的设备令牌的日志。 Problem: When I try to send push from Firebase Console, I am not receiving any Notification. 问题:当我尝试从Firebase控制台发送推送时,我没有收到任何通知。
Have anyone faced such issue and could help me with this ? 有没有人遇到这样的问题,可以帮助我吗?
So, after running a lot through trial and error method, I succeeded in getting Notifications. 所以,经过试错法运行后,我成功获得了通知。
Things to be noted: 需要注意的事项:
google-services.json
file in his directory and not in library module directory. google-services.json
文件,而不是在库模块目录中。 apply plugin: 'com.google.gms.google-services'
申请插件:'com.google.gms.google-services'
So, once I made those two changes, I was able to get Notifications. 所以,一旦我做了这两个更改,我就能得到通知。
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.
FCM客户端要求安装了Android 2.3或更高版本且安装了Google Play商店应用的设备,或运行带有Google API的Android 2.3的模拟器。
If you are Using an Emulator Please Check whether Google APIs were installed or Not. 如果您使用的是仿真器,请检查是否已安装Google API。
Integrating FCM using Android Studio is very easy, You have to only , Tool->>Firebase->>on the Right panel ->>Choose cloud Messaging. 使用Android Studio集成FCM非常简单,只需在右侧面板上选择工具 - >> Firebase - >> - 选择云消息传递。 Setup-->Firebase cloud messaging.
设置 - > Firebase云消息传递。
Then you have to follow point number 1,2,3. 然后你必须遵循1,2,3号点。 And you have to also register your app to Firebase console also as you already status.
您还必须将您的应用注册到Firebase控制台,因为您已经处于状态。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.