dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.98k stars 1.71k forks source link

.net maui android app not working when deployed to play store when using firebase nuget packages #11538

Closed ikeoriaku123 closed 1 year ago

ikeoriaku123 commented 1 year ago

Description

I beginning to feel a bit frustrated right now as .net maui isn't working 100%. I have two nuget packages I have installed

. When I run a debug on an android phone, I am able to send push notifications and receive but when deployed to the play store, it doesn't work. I have placed traces to diagnose the issue. I have noticed that FirebaseMessagingService does not get called and this line of code: var token = (await FirebaseMessaging.Instance.GetToken()).ToString(); generates an error with java.io.IOException: FIS_AUTH_ERROR. My firebase config is correct as this works for the old app which is still in play store. Why does it work for the old app build with xamarin and not .net maui. Please can someone tell me what I should do as I have run out of ideas. I have spent 5 days trying to figure this thing out. Thank you.

Steps to Reproduce

  1. Deploy .net maui app to play store
  2. Upload to firebase app distribution
  3. Download app on an android phone
  4. Open app
  5. Register a user successfully
  6. Log into the app
  7. Send push notification from another phone
  8. No notification received

Link to public reproduction project repository

N/A

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 11

Did you find any workaround?

No response

Relevant log output

MyApp.Client.Core.Infrastructure.Notifications.NotificationManager.GetToken()
java.io.IOException: FIS_AUTH_ERROR
com.google.firebase.iid.GmsRpc.handleResponse(com.google.firebase:firebase-iid@@21.1.0:7)
com.google.firebase.iid.GmsRpc.lambda$extractResponseWhenComplete$0$GmsRpc(com.google.firebase:firebase-iid@@21.1.0:1)
com.google.firebase.iid.GmsRpc$$Lambda$0.then(Unknown Source:2)
com.google.android.gms.tasks.zzc.run(com.google.android.gms:play-services-tasks@@18.0.2:3)
com.google.firebase.iid.FirebaseIidExecutors$$Lambda$0.execute(Unknown Source:0)
com.google.android.gms.tasks.zzd.zzd(com.google.android.gms:play-services-tasks@@18.0.2:1)
com.google.android.gms.tasks.zzr.zzb(com.google.android.gms:play-services-tasks@@18.0.2:5)
com.google.android.gms.tasks.zzw.zzb(com.google.android.gms:play-services-tasks@@18.0.2:3)
com.google.android.gms.tasks.zzc.run(com.google.android.gms:play-services-tasks@@18.0.2:8)
com.google.android.gms.cloudmessaging.zzz.execute(Unknown Source:0)
com.google.android.gms.tasks.zzd.zzd(com.google.android.gms:play-services-tasks@@18.0.2:1)
com.google.android.gms.tasks.zzr.zzb(com.google.android.gms:play-services-tasks@@18.0.2:5)
com.google.android.gms.tasks.zzw.zzb(com.google.android.gms:play-services-tasks@@18.0.2:3)
com.google.android.gms.tasks.TaskCompletionSource.setResult(com.google.android.gms:play-services-tasks@@18.0.2:1)
com.google.android.gms.cloudmessaging.zzp.zzd(com.google.android.gms:play-services-cloud-messaging@@17.0.0:3)
com.google.android.gms.cloudmessaging.zzr.zza(com.google.android.gms:play-services-cloud-messaging@@17.0.0:2)
com.google.android.gms.cloudmessaging.zzf.handleMessage(com.google.android.gms:play-services-cloud-messaging@@17.0.0:14)
android.os.Handler.dispatchMessage Handler.java:102
android.os.Looper.loop Looper.java:246
android.app.ActivityThread.main ActivityThread.java:8625
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:602
com.android.internal.os.ZygoteInit.main ZygoteInit.java:1130
PureWeen commented 1 year ago

@jonathanpeppers thoughts? @Redth

jonathanpeppers commented 1 year ago

This looks like it is happening in Firebase's Java code, and unrelated to .NET MAUI.

To solve this problem, I would look for anyone having the same problem in Java/Kotlin and see if that applies to your app.

An example I found: https://stackoverflow.com/questions/60698622/java-io-ioexception-fis-auth-error-in-android-firebase

You could also try filing a bug with Firebase: https://firebase.google.com/support/troubleshooter/report/bugs

Hope that helps!

ikeoriaku123 commented 1 year ago

https://stackoverflow.com/questions/60698622/java-io-ioexception-fis-auth-error-in-android-firebase

Thanks @jonathanpeppers I will look into that. I have already sent a request to the firebase support team.