summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java41
1 files changed, 34 insertions, 7 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java
index 8c9cd362d3..ba632ebb20 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java
@@ -9,13 +9,12 @@ import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
import com.mapbox.mapboxsdk.exceptions.MapboxConfigurationException;
-import com.mapbox.mapboxsdk.maps.Telemetry;
+import com.mapbox.mapboxsdk.log.Logger;
+import com.mapbox.mapboxsdk.maps.TelemetryDefinition;
import com.mapbox.mapboxsdk.net.ConnectivityReceiver;
import com.mapbox.mapboxsdk.storage.FileSource;
import com.mapbox.mapboxsdk.utils.ThreadUtils;
-import timber.log.Timber;
-
/**
* The entry point to initialize the Mapbox Android SDK.
* <p>
@@ -25,13 +24,18 @@ import timber.log.Timber;
* </p>
*/
@UiThread
+@SuppressLint("StaticFieldLeak")
public final class Mapbox {
- @SuppressLint("StaticFieldLeak")
+ private static final String TAG = "Mbgl-Mapbox";
+
+ private static ModuleProvider moduleProvider;
private static Mapbox INSTANCE;
+
private Context context;
private String accessToken;
private Boolean connected;
+ private TelemetryDefinition telemetry;
/**
* Get an instance of Mapbox.
@@ -121,10 +125,33 @@ public final class Mapbox {
*/
private static void initializeTelemetry() {
try {
- Telemetry.initialize();
+ INSTANCE.telemetry = getModuleProvider().obtainTelemetry();
} catch (Exception exception) {
- Timber.e(exception);
+ Logger.e(TAG, "Error occured while initializing telemetry", exception);
+ }
+ }
+
+ /**
+ * Get an instance of Telemetry if initialised
+ *
+ * @return instance of telemetry
+ */
+ @Nullable
+ public static TelemetryDefinition getTelemetry() {
+ return INSTANCE.telemetry;
+ }
+
+ /**
+ * Get the module provider
+ *
+ * @return moduleProvider
+ */
+ @NonNull
+ public static ModuleProvider getModuleProvider() {
+ if (moduleProvider == null) {
+ moduleProvider = new ModuleProviderImpl();
}
+ return moduleProvider;
}
/**
@@ -150,4 +177,4 @@ public final class Mapbox {
accessToken = accessToken.trim().toLowerCase(MapboxConstants.MAPBOX_LOCALE);
return accessToken.length() != 0 && (accessToken.startsWith("pk.") || accessToken.startsWith("sk."));
}
-}
+} \ No newline at end of file