1
In debug, I took the token and added it in my Nder and sent PN. I deleted it, recompiled it in release mode and now I can’t send PN(Push Notification). See the code of my Sender:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void button_Click(object sender, RoutedEventArgs e)
{
Task t = new Task(async () =>
{
await SenderMessage();
});
t.Start();
}
public static async Task<IFCMResponse> SenderMessage()
{
FCMClient client = new FCMClient("AAAA0myCZjE:APA91bETPO0K3EtgBhHz_gMXDtBTiQrCsFaOW8wmFxbk5XKrQ57KvYhxTRIW9ZQR_mxNU8ThWe0d0A40JzG-GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG/
var message = new Message()
{
To = "Meu_Token_Gerado_Em_Debug_Anteriormente", //topic example /topics/all
Notification = new AndroidNotification()
{
Body = "Solicitação de Novo Desconto",
Title = "Desconto",
}
};
//CrossBadge.Current.SetBadge(1, "Teste");
var result = await client.SendMessageAsync(message);
return result;
}
}
Is there any way to fix a token for the App? I tried to create a Topics and send the PN through Topics, but it’s a mistake. This is the code to create Topics
And that’s the mistake:
Not Registered
EDIT1
I apologize to everyone, who mixed things up. This message is not from receiving PN, but from trying to create a Topics to receive PN, but they are separate things. I will remove this part. I was being helped by Perozzo and even then, it did not influence anything, because he understood throughout our conversation my problem, although he refers to the message posted by me. My mistake, I posted in the "package" of wanting to solve.
The error message tells you exactly what to do, call the Firebasepp.Initializeapp(Context) method before sending Push Notification.
– perozzo
The problem I don’t have the Firebasepp, I don’t know what class it belongs to. I’m exactly looking for this.
– pnet
I searched here. I saw that if you delete the obj and bin folder of your project and then rebuild it again, it will work. Delete folders with visual studio closed. Open the project and rebuild.
– perozzo
@Perozzo, the google-services.json file should do things automatically. It should not add any,the extra line, depending on the message.
– pnet
I edited the title that was wrong. Is to receive and not send.
– pnet
As I researched, this is a bug. You tried to do what I said?
– perozzo
Let’s go continue this discussion in chat.
– perozzo