A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
Thanks for reaching out. The exception is returned by Google Play Services when FCM cannot issue or refresh a registration token. This is not a .NET MAUI runtime issue-it normally occurs when the device or Firebase project configuration is not valid for the currently installed app build.
Root cause that commonly generate this error
One or more of the following is usually true:
- The google-services.json does not match the app package name in the Android manifest.
- The SHA-1 signing certificate is missing or changed in Firebase
- The app was not re-initialized after switching Firebase projects
- The device/emulator does not have valid Google Play Services.
- Network connectivity / FCM service is temporarily unavailable.
Recommended Resolution Steps:
- Uninstall the existing app from the device When switching to a different Firebase project, the previous InstanceID/token remains cached and prevents token creation. Uninstall -> Clean-> Re-install ensures a fresh FCM identity.
- Verify package name & applicationId match Check all three match exactly:
- Google-services.json
- AndroidManifest / MAUI package id
- Firebase project App registration
- Add SHA-1 for your signing key in Firebase Console If you are using a debug or release signing key, add the SHA-1 fingerprint for it in: Firebase Console-> Project Settings-> Android App-> Add SHA-1 Then download a new google-services.json and add it to the project. After replacing the file:
- Clean bin/obj
- Rebuild
- Re-install the app
- Ensure the JSON file is in the correct MAUI location Place it under:
Set build action to:Platforms/Android/google-services.jsonGoogleServicesJson - Test on a device with Google Play Services The error will occur on:
- Non-GMS emulators
- Devices without Play Services
- Out-of-date Play Services
- Call GetTokenAsync() only after validation succeeds Wrap your call defensively to avoid crashing:
Avoid calling it in the page constructor- instead trigger it:private async Task GetTokenAsync() { try { var vaid = await CrossFirebaseCloudMessaging.Current.CheckIfValidAsync(); if (!valid) { Console.WriteLine("FCM not yet ready - retry later"); return; } var token = await CrossFirebaseCloudMessaging.Current.GetTokenAsync(); Console.WriteLine($"FCM Token: {token}"); } catch (exception ex) { Console.WriteLine($"Token error: {ex.Message}"); } }- After the page loads, or
- After CheckIfValidAsync() returns true.
Why it worked with the demo JSON but fails now
The demo JSON and your production JSON belong to different Firebase projects.
After switching projects, the cached instanceID on the device no longer matches the project configuration, so FCM responds with:
SERVICE_NOT_AVAILABLE
Re-installing the app + downloading a new JSON resolves this in almost all cases.
Please let us know if you require any further assistance we’re happy to help. If you found this information useful, kindly mark this as "Accept Answer".