这个是firebase的一些教程。我正在Firebase注册应用程序,获取google-services.json文件,并将其粘贴到应用程序文件中,如教程中所示。也得到令牌。但是当我试图从控制台发送通知,状态是失败的(我猜MismatchSenderId)。我插入了从 FirebaseInstanceId.getInstance()。getToken(); 获得的相同标记。可能是什么问题?
当我向所有使用该应用程序的设备发送通知时,它也没有成功。
编辑:清单文件
<! - 添加Internet权限 - > <使用权限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> < category android:name =android.intent.category.LAUNCHER/> < / intent-filter> < / activity> <! - 定义服务 - > < 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>解决方案
请检查下列条件是否满足。
希望它能帮助你...
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控制台发送通知
发布评论