4

I want to do FCM in Xamarin.Android.

So I following this tutorial (Xamarin.Android)Remote Notifications with Firebase Cloud Messaging to do.

but my phone can't receive message.

my output get :

[FirebaseMessaging] Unable to log event: analytics library is missing

I had add two NuGet:

  1. Xamarin.GooglePlayServices.Base.
  2. Xamarin.Firebase.Messaging.

I tried this Xamarin.Android

Updating Xamarin.Build.Download to 0.4.11

but it's still not working...

What can I do ?

KENdi
  • 7,576
  • 2
  • 16
  • 31
Una
  • 41
  • 1
  • 1
  • 4
  • Did you add `google-services.json` to the project? – Mehdi Dehghani Apr 11 '19 at 04:45
  • @MehdiDehghani Yes, I did add `google-services.json` ,and I Set the Build Action to `GoogleServicesJson` – Una Apr 11 '19 at 05:13
  • Do you want to do [Firebase Cloud Messaging](https://learn.microsoft.com/en-us/xamarin/android/data-cloud/google-messaging/firebase-cloud-messaging)? – Mehdi Dehghani Apr 11 '19 at 05:51
  • @MehdiDehghani Yes, I want to do FCM. – Una Apr 11 '19 at 05:58
  • Would you update your question and say what nuget packages have you added to the project? also your Mono.Android version and any other related info. I did FCM in Xamarin.Android without any issue. to do that you need to add some nuget packages, one class and few settings, it's not hard to follow. – Mehdi Dehghani Apr 11 '19 at 06:04
  • I have a step by step guide to follow for FCM setup in Xamarin.Android check this https://heartbeat.fritz.ai/firebase-cloud-messaging-for-remote-push-notifications-on-android-with-xamarin-3c72fffcd25?source=your_stories_page--------------------------- – FreakyAli Apr 11 '19 at 06:52
  • Thank you everyone to help me. It's working now. thank you so much guys. – Una Apr 11 '19 at 07:22
  • 2
    @G.hakim I'm wondering (in your mentioned link) did you copy and paste the [Microsoft's doc](https://learn.microsoft.com/en-us/xamarin/android/data-cloud/google-messaging/remote-notifications-with-fcm?tabs=windows) or they did? – Mehdi Dehghani Apr 11 '19 at 12:09
  • @MehdiDehghani There are certain steps that you have to copy because they remain the same from the main guide, pick any post available and see for yourself, I mean seriously! Secondly, i have mentioned the same in that blog as well i do not know how you missed it. – FreakyAli Apr 11 '19 at 12:31
  • 2
    @G.hakim I can say, most of your main content is exact same as Microsoft's one. even pictures, that means you didn't try that yourself (maybe you did, but it's not obvious, based on the content of your article). anyway here is not right place to discuss about that. – Mehdi Dehghani Apr 11 '19 at 12:35
  • @MehdiDehghani `most of your main content is exact same as Microsoft's one.` Compare the images and you might notice that it is not – FreakyAli Apr 11 '19 at 12:37
  • @Una Can you share your solution as an answer? – Leon Apr 12 '19 at 05:46
  • It's weird! I did't do any thing just rebuild my app. sometime It's work, but now it doesn't work. Still output the same message. – Una Apr 15 '19 at 03:24
  • I solve the problem! The reason why it is not working, cause our company wifi blocked the external packet. – Una Apr 19 '19 at 08:51

1 Answers1

11

I am at the same step and faced the same situation, until I read forward and found this:

On the Android device (or emulator), background the app by tapping the Android Overview button and touching the home screen. When the device is ready, click SEND MESSAGE in the Firebase Console:

By doing it that way the message can be seen at the notification bar: enter image description here

I am new to this but I am realizing that the purpose of this first test is to receive the message when the app is not in the foreground... See also: Send Message paragraph in the Remote Notifications with Firebase Cloud Messaging tutorial.

Lupa
  • 586
  • 1
  • 8
  • 22