This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[android] #5004 - Initial MapboxAccountManager singleton
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
...m/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/MapboxAccountManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.mapbox.mapboxsdk; | ||
|
||
public class MapboxAccountManager { | ||
|
||
private static MapboxAccountManager mapboxAccountManager = null; | ||
|
||
private final String accessToken; | ||
|
||
/** | ||
* MapboxAccountManager should NOT be instantiated directly. | ||
* Use MapboxAccountManager.getInstance() instead. | ||
* @param accessToken | ||
*/ | ||
private MapboxAccountManager(String accessToken) { | ||
super(); | ||
this.accessToken = accessToken; | ||
} | ||
|
||
/** | ||
* Get an instance of MapboxAccountManager configured with the app's Access Token | ||
* @param accessToken Mapbox Access Token. You can get one on the Mapbox Web site. | ||
* @return MapboxAccountManager instance for app | ||
*/ | ||
public static MapboxAccountManager getInstance(String accessToken) { | ||
if (mapboxAccountManager == null) { | ||
mapboxAccountManager = new MapboxAccountManager(accessToken); | ||
} | ||
return mapboxAccountManager; | ||
} | ||
|
||
/** | ||
* Access Token for this application | ||
* @return Mapbox Access Token | ||
*/ | ||
public String getAccessToken() { | ||
return accessToken; | ||
} | ||
} |