Help: Expo MapView

Hi, I am using the MapView component for creating an Expo app so it is compatible both with android and ios operating systems. I am not really sure what is the difference between standalone app and bare app, so I cannot tell you what do I have.

The thing is that when I am writing code, just by setting map view and no api key or anything, it works like if it is using the default map of the mobile phone. I do not know if it is because I am in production, or because it works that way.
Just this code:

import {MapView} form 'expo';

....

render() {
    return (
        <MapView style={styles.map}
          showsUserLocation={true}
          region={this.state.region}
        >
        </MapView>
    );
  }

So I do not understand why this is working without any trouble, and I am afraid it wont when I produce the corresponding android and ios apps.

I use firebase configuration and google sign in too, so maybe it is using one of those apiKeys?

If anyone could help please.

Thank tou

Hey @guardme,

Sorry, but I’m confused here. After reading this, it seems like there isn’t an issue and it is working? :face_with_monocle:

Can you elaborate on what is going on here, specifically what information you would like to know?

Cheers,
Adam

Hi @adamjnav,
What I want to know is if Expo uses the installed map in the corresponding os, that is Google Maps in Android and the Aplle Maps in iOs, when the app is under construction, or if it always uses that so then it doesn’t need an api key from google maps or similar.

I ask, because when I get it to work and create the binaries and everything I want it to work same way as it is working now.

Thank you

PS: As I see you are from the Expo team, could you please take a look at my last post, because I am having real issues with Expo

For development and standalone iOS apps, there is no configuration needed. MapView will default to using the respective map platforms for each OS. Meaning iOS will use Apple Maps and Google will use Google Maps.

For standalone Google apps, you’ll need to get a Google API key from Google. The configuration steps are here: https://docs.expo.io/versions/v32.0.0/sdk/map-view/#deploying-to-a-standalone-app-on-android

If you want your iOS version to also use Google Maps, you can add the Google API key as the value for ios.config.googleMapsApiKey in your app.json and then change the provider property on your MapView component.

Cheers,

Adam

1 Like

Hi @adamjnav,

So, if I got it correctly what you are telling me is that:
If I want the standalone (which I think I have…) app to have a map view, I just need to configure the android.config.googleMaps.apiKey?
The thing is, my google-sign-in, as expo had some issues, I did it directly with firebase module, so I do not know exactly what to do follow: If you already have Google Sign In configured or just If you already have not configured Google Sign In.

Moreover, iOS never needs api key? Well that is then perfect. I assume I am now bound to the restrictions of the api key to google maps with reference to the number of simultaneous connections, etc.

Thank ou very much

PS: I am new to all Expo and React-Native stuff so sorry for being this hard

@adamjnav if you could please confirm what I wrote in the previous answer, I would really appreciate it, thank you

Hey @guardme,

You are correct that iOS does not need an API key.

As for the Google question, I’m not entirely sure. I think the best way to find out is to build an .apk with expo build:android and test it. If you do not get an error loading the MapView page, you should be good to go. If you do, then you’ll know you need to configure a Google API.

Cheers,
Adam

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.