问题描述
这个是一些firebase的教程.我在 Firebase 中注册应用程序,获取 google-services.json 文件,将其粘贴到应用程序文件中,如教程中所示.也得到令牌.但是当我尝试从控制台发送通知时,状态失败(我猜是 MismatchSenderId).我正在插入从 FirebaseInstanceId.getInstance().getToken(); 获得的相同令牌.可能是什么问题?
附言当我向所有使用该应用程序的设备发送通知时,它也没有成功.
清单文件
<使用权限android:name="android.permission.INTERNET"/><应用机器人:allowBackup="真"android:icon="@mipmap/ic_launcher"android:label="@string/app_name"安卓:supportsRtl="true"android:theme="@style/AppTheme"><activity android:name=".MainActivity"><意图过滤器><action android:name="android.intent.action.MAIN"/><类别 android:name="android.intent.category.LAUNCHER"/></意图过滤器></活动><!--定义服务--><服务android:name=".MyFirebaseMessagingService"><意图过滤器><action android:name="com.google.firebase.MESSAGING_EVENT"/></意图过滤器></服务><服务android:name=".MyFirebaseInstanceIDService"><意图过滤器><action android:name="com.google.firebase.INSTANCE_ID_EVENT"/></意图过滤器></服务></应用程序>请检查是否满足以下所有条件.
<块引用>- 在您的控制台中更新 SHA 1 指纹和软件包名称.
- 从开发者控制台放置一个 json 配置文件,并将其放在 app 目录 [模块级目录] 下.
- 在 gradle 文件中添加这些行.a) 模块 gradle:应用插件:'com.google.gms.google-services'b) 项目 gradle:类路径 'com.google.gms:google-services:3.0.0'
希望对你有帮助...
This is some tutorial of firebase. I'm registering app in Firebase, getting the google-services.json file, pasting it in the app files as shown in the tutorial. Also getting the token. But when I'm trying to send notification from console, the status is failed (I guess MismatchSenderId). I'm inserting the same token that I got from FirebaseInstanceId.getInstance().getToken();. What can be the problem?
p.s. When I send notification to all devices that uses the app, it didn't succeed too.
EDIT: Manifest File
<!-- Adding Internet Permission -->
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!--
Defining Services
-->
<service
android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service
android:name=".MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
</application>
Kindly check if all the below conditions were satisfied.
- Update the SHA 1 finger print and package name in your console.
- Place a json configuration file from the developer console and place it under app directory [module level directory].
- Add these lines in the gradle files. a) Module gradle : apply plugin: 'com.google.gms.google-services' b) Project gradle : classpath 'com.google.gms:google-services:3.0.0'
Hope it helps you...
这篇关于无法从 Firebase 控制台发送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)