Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Android push notifications “Message was successfully sent, but there were no matching targets."

luislemaluislema Member ✭✭

I am trying to setup push notifications on a Xamarin.Forms Android app following this tutorial and this sample. My AndroidManifest.xml, FirebaseService.cs and MainActivity.cs are basically the same as the sample. When I fire up the Android Emulator and do a Test Send from Azure Notification Hubs I get: "Message was successfully sent, but there were no matching targets." Is that tutorial outdated?

Best Answer

  • luislemaluislema Member ✭✭
    edited July 7 Accepted Answer

    I used a real device to debug the application and I got an error message: "Java.Lang.RuntimeException: 'Unable to instantiate receiver com.google.firebase.iid.FirebaseInstanceIdReceiver: java.lang.InstantiationException: java.lang.Class<com.google.firebase.iid.FirebaseInstanceIdReceiver> cannot be instantiated'"

    This was due to my code shrinker (ProGuard/R8) missing some configurations. Following this article I created a proguard.cfg file and added this:
    -dontwarn com.google.android.gms.** -keep class com.google.android.gms.** { *; } -keep class com.google.firebase.** { *; }

    I tried a Test Send from Azure Notification Hubs and it worked!

Answers

  • luislemaluislema Member ✭✭
    edited July 7 Accepted Answer

    I used a real device to debug the application and I got an error message: "Java.Lang.RuntimeException: 'Unable to instantiate receiver com.google.firebase.iid.FirebaseInstanceIdReceiver: java.lang.InstantiationException: java.lang.Class<com.google.firebase.iid.FirebaseInstanceIdReceiver> cannot be instantiated'"

    This was due to my code shrinker (ProGuard/R8) missing some configurations. Following this article I created a proguard.cfg file and added this:
    -dontwarn com.google.android.gms.** -keep class com.google.android.gms.** { *; } -keep class com.google.firebase.** { *; }

    I tried a Test Send from Azure Notification Hubs and it worked!

  • jezhjezh Member, Xamarin Team Xamurai

    Congrats, and thanks for sharing the answer. :)

Sign In or Register to comment.