@UiThread
public final class Mapbox
extends java.lang.Object
Obtain a reference by calling getInstance(Context, String)
. Usually this class is configured in
Application#onCreate() and is responsible for the active access token, application context, and
connectivity state.
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getAccessToken()
Get the current active access token for this application.
|
static android.content.Context |
getApplicationContext()
Application context
|
static Mapbox |
getInstance(android.content.Context context,
java.lang.String accessToken)
Get an instance of Mapbox.
|
static ModuleProvider |
getModuleProvider()
Get the module provider
|
static java.lang.String |
getSkuToken()
Returns a SKU token, refreshed if necessary.
|
static TelemetryDefinition |
getTelemetry()
Get an instance of Telemetry if initialised
|
static boolean |
hasInstance()
Internal use.
|
static java.lang.Boolean |
isConnected()
Determines whether we have an internet connection available.
|
static void |
setAccessToken(java.lang.String accessToken)
Set the current active accessToken.
|
static void |
setConnected(java.lang.Boolean connected)
Manually sets the connectivity state of the app.
|
@UiThread @NonNull public static Mapbox getInstance(@NonNull android.content.Context context, @Nullable java.lang.String accessToken)
This class manages the Mapbox access token, application context, and connectivity state.
context
- Android context which holds or is an application contextaccessToken
- Mapbox access token@Nullable public static java.lang.String getAccessToken()
public static void setAccessToken(java.lang.String accessToken)
public static java.lang.String getSkuToken()
@NonNull public static android.content.Context getApplicationContext()
public static void setConnected(java.lang.Boolean connected)
connected
- flag to determine the connectivity state, true for connected, false for
disconnected, and null for ConnectivityManager to determine.public static java.lang.Boolean isConnected()
@Nullable public static TelemetryDefinition getTelemetry()
@NonNull public static ModuleProvider getModuleProvider()
public static boolean hasInstance()
INSTANCE
is present.