2
I had several projects on my console. I was able to receive push notification (PN). So I dropped all the projects and created just one. I made an app based on the step by step that a colleague passed me and I could not receive. I took the App that was working, and put in this same project newly created on the firebase console. Well, it turns out that when I go through my PN sending program, when I do a new PN, it makes me wrong:
Mismatchsenderid
The interesting thing is that when I gave the first start on the application, a PN was sent, but not by me, as if I was trapped and the startar she came, but that was it. Then he gave no further message, making that mistake. I’m debugging to see what can be and I think it should be the same thing that’s keeping me from getting PN for this new approach that I’m doing.
EDIT1
My Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.global.autorizador.br" android:installLocation="internalOnly" android:versionName="Spike">
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="25" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:label="Autorizador.Android" android:icon="@drawable/icon">
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
android:exported="false" />
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
</application>
</manifest>
This App was working and getting PN
EDIT2
This is the code for sending PN
public static async Task<IFCMResponse> SenderMessage()
{
FCMClient client = new FCMClient("XXXXXXXXXXXXXXXXX"); //as derived from https://console.firebase.google.com/project/
var message = new Message()
{
To = "YYYYYYYYYYYYYYYYYY", //topic example /topics/all
Notification = new AndroidNotification()
{
Body = "Solicitação de Novo Desconto",
Title = "Desconto",
}
};
var result = await client.SendMessageAsync(message);
return result;
}
What I can guarantee is that Fcmclient is receiving the key from the current project server and Message is receiving the token, the moment the App is started. How do I do? I place a break where it is registered, I take this token and colo in the application Sender. And when I send the message, I break into Return result and there I see the mistake of Mismatchsenderid. What may be incorrect would be the firebase, but I saw the URL and is OK and within the project has those values generated by it(project) and I think they are correct too.
What I found strange is that this piece on google-services.json was this way
"api_key": [
{
"current_key": "AIzaSyCHqktEMu9xPGHnXpEXWwRpimBRgzv-MHU"
}
]
and since the server’s web api key was another, I switched to the key that was on the server. This is enough to say that something is wrong, because when we get to the point of changing something generated automatically, is problem.
"api_key": [
{
"current_key": "AIzaSyB2iXNmbPjvwZqDNubYX2Sy6QMsMJmw3N4"
}
]
I don’t know if I did it right, I’m not sure if the key used in current_key is the same web api key
EDIT3
Reading on the internet related subjects, I discovered that Senderid that the application is running, is not the same that is in the project. How does this happen and how do you fix it? This is what the app is loading:
857564901519
and this is the project that is being pointed out by the program that sends the PN
903763617329
What I found strange is in this project I have two App’s. But when I google-services.json it always points to the same app, the same Package Name and altered it amnually and I think that’s what zoomed everything.
– pnet