-
Notifications
You must be signed in to change notification settings - Fork 507
Mapbox access tokens
This project uses Mapbox vector tiles, which requires a Mapbox account and a Mapbox access token. Obtain a free access token on your Mapbox account page.
Even if you do not use Mapbox vector tiles but vector tiles from a different source (like self-hosted tiles) with this plugin, you will need to specify any non-empty string as Access Token as explained below!
The recommended way to provide your access token is through the MapboxMap
constructor's accessToken
parameter, which is available starting from the v0.8 release. Note that you should always use the same token throughout your entire app.
For earlier versions you need to set your access token through platform-specific files as described below. This will also continue to work as a fallback on v0.8. You should not set the access token through both the constructor parameter and platform-specific files!
Add Mapbox access token configuration in the application manifest example/android/app/src/main/AndroidManifest.xml
:
<manifest ...
<application ...
<meta-data android:name="com.mapbox.token" android:value="YOUR_TOKEN_HERE" />
Add Mapbox access token configuration to the application Info.plist example/ios/Runner/Info.plist
:
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>MGLMapboxAccessToken</key>
<string>YOUR_TOKEN_HERE</string>
Add Mapbox access token configuration to index.html example/web/index.html
:
<body>
...
<script>
mapboxgl.accessToken = 'YOUR_TOKEN_HERE';
</script>
</body>