I can’t receive messages for my App in release mode

Asked

Viewed 18 times

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.

  • The problem I don’t have the Firebasepp, I don’t know what class it belongs to. I’m exactly looking for this.

  • 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, the google-services.json file should do things automatically. It should not add any,the extra line, depending on the message.

  • I edited the title that was wrong. Is to receive and not send.

  • As I researched, this is a bug. You tried to do what I said?

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.