Change MAPBOX_ACCESS_TOKEN on runtime
taq opened this issue · 1 comments
taq commented
Hi!
As said on every doc about installation, we need to set MAPBOX_ACCESS_TOKEN on our build.gradle file, loading it from properties, ok ... but I need to change the token for a specific customer token, after the login process, is it possible?
While writing this I found a reference to setAccessToken, maybe is the right way? Is there any examples to use it with Kotlin on V10?
Thanks!
taq commented
I think I figured it out with V10:
// Set the application-scoped ResourceOptionsManager with customised token and tile store usage mode
// so that all MapViews created with default config will apply these settings.
ResourceOptionsManager.getDefault(this, getString(R.string.mapbox_access_token)).update {
tileStoreUsageMode(TileStoreUsageMode.READ_ONLY)
}
I just was thinking that setDefault
would be a better name (write to the defaults), but anyway, this way, as stated all resources (maps, routes) after that will use that specific token, right? Even if I use only:
ResourceOptionsManager.getDefault(this, getString(R.string.mapbox_access_token))