Reputation: 4560
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>
Upvotes: 3
Views: 7049
Reputation: 4781
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...
Upvotes: 4
Reputation: 5841
May be you're not add a correct SHA1 for your application? you can follow this tutorial to get the correct SHA1. And then on console firebase choose project setting, choose add SHA1. After that, you need to replace google-services.json with the newest one.
Upvotes: 0