2

I am developing an Expo Application that uses react-native-maps. the application works absolutely fine when I open it in Expo Client. but android "APK" build of standalone app reloads every time I open a screen that includes react-native-maps.

I did the following setup for react-native-maps:

  1. Enabled "Maps SDK for Android" in my Google Cloud.
  2. Created a new API Credentials and restricted it to android apps and included my app fingerprint just like the steps in https://docs.expo.io/versions/latest/sdk/map-view .
  3. copied the API key and added it to app.json file.
"android": {
      "icon": "./assets/images/app-icon.png",
      "useNextNotificationsApi": true,
      "adaptiveIcon": {
        "foregroundImage": "./assets/images/app-adaptive-icon.png",
        "backgroundColor": "#FFFFFF"
      },
      "googleServicesFile": "./google-services.json",
      "package": "PACKAGE_NAME",
      "config": {
        "googleMaps": {
          "apiKey": "API_KEY"
        }
      },
      "versionCode": 1
},

I have also tried to change the Application restrictions to None in Google API Credential Settings just in case if my settings weren't right and I couldn't get the correct Correct App Fingerprint. But that also didn't work.

Another hint that might be related to the problem, I'm also using Expo Notifications Services. if I run the app using Expo Client, I can send notifications to the app without any problem. but If I build a standalone APK, and use expo notifications tool to send the notification, I get this error:

InvalidCredentials: Failed to authenticate with the FCM server. Ensure the FCM server key you uploaded is correct.

Although I have added google-services.json file in my app root. and did this command:

expo push:android:upload --api-key <your-token-here>

I'm using Expo: ~39.0.2 With Managed Workflow.

Abdel Rahman
  • 121
  • 5
  • Can you post your MapView code and maybe the component which renders it? Also, about the notifications, maybe this tutorial helps: https://docs.expo.dev/push-notifications/using-fcm/ – DariusP May 02 '22 at 13:47

0 Answers0