メインコンテンツまでスキップ
For the complete documentation index, see llms.txt.

Access Private Preview Modules

Complete the standard Get Started guide first. Some Nav SDK modules are in private preview and are only available to accounts that Mapbox has explicitly enabled — if you need one of those, follow the additional steps below afterward.

Get access to a private preview module

Some modules are private preview and require Mapbox to enable access for your account before you can use them. Contact us to request access.

Configure a secret token​

Once Mapbox has enabled a private preview module for your account, configure a secret access token to authenticate downloads of that module.

Step 1: Create a secret token​

A secret access token is required to download the SDK dependencies in your Android project. This token is used by gradle to authenticate with the Mapbox maven server where the SDK packages are hosted.

To create a secret token, follow these steps:

  1. Go to your account's tokens page.
  2. Click the Create a token button.
  3. Name your token, for this example we've used InstallTokenAndroid.
  4. Scroll down to the Secret Scope section and check the Downloads:Read scope box.
  5. Click the Create token button at the bottom of the page to create your token.
  6. Enter your password to confirm the creation of your token.
  7. Now, you'll be returned to your account's tokens page, where you can copy your created token. Note, this token is a secret token, which means you will only have one opportunity to copy it, so save this token somewhere secure.
Protect secret access tokens

You should not expose secret access tokens in publicly-accessible source code where unauthorized users might find them. Instead, you should store them somewhere safe on your computer and take advantage of Gradle properties to make sure they're only added when your app is compiled.

Step 2: Configure your secret token​

Next, add your secret token to your global gradle.properties file. The global gradle.properties file is located in your Gradle user home folder, but is also available in Android Studio's project explorer under Gradle Scripts/gradle.properties (Global Properties)

If you don't have a gradle.properties file, create one. Add your secret token to the gradle.properties file as shown below, replacing the placeholder YOUR_SECRET_MAPBOX_ACCESS_TOKEN with your secret token.

~/.gradle/gradle.properties
MAPBOX_DOWNLOADS_TOKEN=YOUR_SECRET_MAPBOX_ACCESS_TOKEN

Your secret token is now configured and will be used to authenticate with the Mapbox maven server when you add the SDK dependency to your project.

Add your token to the Mapbox Maven repository​

Private preview modules are downloaded from the same Mapbox Maven repository you already added in Get Started — update that maven {...} block in your settings.gradle.kts file to authenticate with the secret token you configured:

settings.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
// Mapbox Maven repository
maven {
url = uri("https://api.mapbox.com/downloads/v2/releases/maven")
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be `mapbox` (not your username).
username = "mapbox"
// Use the secret token you stored in gradle.properties as the password
password = providers.gradleProperty("MAPBOX_DOWNLOADS_TOKEN").get()
}
}
}
}

Add the dependency​

Add the private preview module to your module-level build.gradle.kts file the same way you would any other Nav SDK dependency, using the artifact ID from the module's own guide. For example, installing the NOA module looks like this:

build.gradle
dependencies {
...
implementation "com.mapbox.navigationcore:noa:3.31.1"
...
}

See the module's own guide for its exact dependency coordinates.

この{Type}は役に立ちましたか?