Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't retrieve Firebase Token #869

Closed
JimAIT opened this issue May 14, 2024 · 2 comments
Closed

Can't retrieve Firebase Token #869

JimAIT opened this issue May 14, 2024 · 2 comments

Comments

@JimAIT
Copy link

JimAIT commented May 14, 2024

Updated for Xamarin to MAUI.
I used to get the firebase token via FirebaseInstanceId.Instance.Token
That doesn't exist anymore.

It now says to use FirebaseMessaging.Instance.GetToken()
When I try it use that, I get the error Default FirebaseApp is not initialized in this process. Make sure to call FirebaseApp.initializeApp(Context) first.

So I added the following first: FirebaseApp.InitializeApp(Android.App.Application.Context);
Still get the same error message. I can't find a simple example on how to get this token now like I used to.

@jpobst
Copy link
Contributor

jpobst commented May 15, 2024

Ultimately, all these packages do is provide generated wrappers that allow you to call Google’s API. We do not have much expertise in how to use those API’s properly.

You will likely need to use the Google's API documentation and relevant forums to determine how to write code for your desired outcome.

@JimAIT
Copy link
Author

JimAIT commented May 23, 2024

So in the upgrade to MAUI, it looks like I missed the google-services.json file. After I added that to my MAUI project. I was able to get the token via
string FirebaseToken = FirebaseMessaging.Instance.GetToken().Result.ToString();

@JimAIT JimAIT closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants