1

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?

2
  • 1
    If you have access to a real device try running your app there and see if you have other results. Commented Jul 7, 2020 at 6:47
  • 1
    Thanks, that helped me get 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'" I need to figure out why this is happening. Commented Jul 7, 2020 at 17:50

1 Answer 1

6

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!

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for following up and providing what worked! I'm glad you got it working. :)
@Luis Do you happen to remember what clases/libraries you needed to "keep" to make this work ? I am getting the same error and have tried multiple variations of the class names and it still keeps failing
Thanks! I've been using the FirebasePushNotificationPlugin in Xamarin.Forms and this resolved my problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.