这个是一些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"/></意图过滤器></服务></应用程序> 解决方案请检查是否满足以下所有条件.
希望对你有帮助...
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.
Hope it helps you...
更多推荐
无法从 Firebase 控制台发送通知
发布评论