diff options
Diffstat (limited to 'platform')
6 files changed, 17 insertions, 73 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/AccountsManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/AccountsManager.java index d086b3329e..4fd0200a37 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/AccountsManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/AccountsManager.java @@ -2,74 +2,41 @@ package com.mapbox.mapboxsdk; import android.content.Context; import android.content.SharedPreferences; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.text.TextUtils; import android.text.format.DateUtils; import com.mapbox.android.accounts.v1.MapboxAccounts; import com.mapbox.mapboxsdk.constants.MapboxConstants; -import com.mapbox.mapboxsdk.log.Logger; /** - * IF YOU USE THIS CODE WITH MAPBOX MAPPING API, REMOVAL OR MODIFICATION OF - * THE FOLLOWING CODE VIOLATES THE MAPBOX TERMS OF SERVICE. + * REMOVAL OR MODIFICATION OF THE FOLLOWING CODE VIOLATES THE MAPBOX TERMS + * OF SERVICE * - * The following code is used to access Mapbox's Mapping APIs. Removal or - * modification of this code when used with Mapbox's Mapping APIs can result - * in higher fees and/or termination of your account with Mapbox. + * The following code is used to access Mapbox's Mapping APIs. * - * Under the Mapbox Terms of Service, you may not use this code to access - * Mapbox Mapping APIs other than through Mapbox SDKs. + * Removal or modification of this code when used with Mapbox's Mapping APIs + * can result in termination of your agreement and/or your account with + * Mapbox. * - * The Android documentation to access Mapping APIs is available at - * https://www.mapbox.com/android and the Mapbox Terms of Service are - * available at https://www.mapbox.com/tos/. + * Using this code to access Mapbox Mapping APIs from outside the Mapbox Maps + * SDK also violates the Mapbox Terms of Service. On Android, Mapping APIs + * should be accessed using the methods documented at + * https://www.mapbox.com/android. + * + * You can access the Mapbox Terms of Service at https://www.mapbox.com/tos/ */ class AccountsManager { - private static final String TAG = "Mbgl-AccountsManager"; - private static final String PREFERENCE_USER_ID = "com.mapbox.mapboxsdk.accounts.userid"; private static final String PREFERENCE_TIMESTAMP = "com.mapbox.mapboxsdk.accounts.timestamp"; private static final String PREFERENCE_SKU_TOKEN = "com.mapbox.mapboxsdk.accounts.skutoken"; private long timestamp; - @Nullable private String skuToken; - private boolean isEnabled; - AccountsManager() { - isEnabled = isSkuTokenEnabled(); - if (isEnabled) { - String userId = validateUserId(); - validateRotation(userId); - } else { - timestamp = 0L; - skuToken = null; - } - } - - private boolean isSkuTokenEnabled() { - boolean value = MapboxConstants.DEFAULT_ENABLE_SKU_TOKEN; - try { - // Try getting a custom value from the app Manifest - ApplicationInfo appInfo = Mapbox.getApplicationContext().getPackageManager().getApplicationInfo( - Mapbox.getApplicationContext().getPackageName(), - PackageManager.GET_META_DATA); - if (appInfo.metaData != null) { - value = appInfo.metaData.getBoolean( - MapboxConstants.KEY_META_DATA_ENABLE_SKU_TOKEN, - MapboxConstants.DEFAULT_ENABLE_SKU_TOKEN - ); - } - } catch (Exception exception) { - Logger.e(TAG, "Failed to read the package metadata: ", exception); - } - - return value; + String userId = validateUserId(); + validateRotation(userId); } private String validateUserId() { @@ -95,9 +62,8 @@ class AccountsManager { } } - @Nullable String getSkuToken() { - if (isEnabled && isExpired()) { + if (isExpired()) { SharedPreferences sharedPreferences = getSharedPreferences(); String userId = sharedPreferences.getString(PREFERENCE_USER_ID, ""); skuToken = generateSkuToken(userId); 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 363d8469f4..5a1c49a0a4 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 @@ -96,7 +96,6 @@ public final class Mapbox { * * @return the SKU token */ - @Nullable public static String getSkuToken() { return INSTANCE.accounts.getSkuToken(); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java index 6be803cb14..ffcf8d74ec 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java @@ -38,16 +38,6 @@ public class MapboxConstants { public static final boolean DEFAULT_MEASURE_TILE_DOWNLOAD_ON = false; /** - * Key used to switch SKU token on/off in AndroidManifest.xml - */ - public static final String KEY_META_DATA_ENABLE_SKU_TOKEN = "com.mapbox.EnableSkuToken"; - - /** - * Default value for KEY_META_DATA_ENABLE_SKU_TOKEN (default is off) - */ - public static final boolean DEFAULT_ENABLE_SKU_TOKEN = false; - - /** * Unmeasured state */ public static final float UNMEASURED = -1f; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HttpRequestUrl.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HttpRequestUrl.java index 99d9cc4adf..6a1b641d67 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HttpRequestUrl.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HttpRequestUrl.java @@ -24,11 +24,7 @@ public class HttpRequestUrl { } else { resourceUrl = resourceUrl + "&"; } - if (Mapbox.getSkuToken() != null) { - resourceUrl = resourceUrl + "events=true&sku=" + Mapbox.getSkuToken(); - } else { - resourceUrl = resourceUrl + "events=true"; - } + resourceUrl = resourceUrl + "sku=" + Mapbox.getSkuToken(); } return resourceUrl; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java index af2e0ad749..92e9f44d50 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java @@ -41,9 +41,7 @@ public class TelemetryImpl implements TelemetryDefinition { public void onAppUserTurnstileEvent() { AppUserTurnstile turnstileEvent = new AppUserTurnstile(BuildConfig.MAPBOX_SDK_IDENTIFIER, BuildConfig.MAPBOX_SDK_VERSION); - if (Mapbox.getSkuToken() != null) { - turnstileEvent.setSkuId(MapboxAccounts.SKU_ID_MAPS_MAUS); - } + turnstileEvent.setSkuId(MapboxAccounts.SKU_ID_MAPS_MAUS); telemetry.push(turnstileEvent); telemetry.push(MapEventFactory.buildMapLoadEvent(new PhoneState(appContext))); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index 18fbf33cc8..bb2bef35fb 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -1002,11 +1002,6 @@ android:name="com.mapbox.MeasureTileDownloadOn" android:value="false" /> - <!-- Set value to true to have SKU tokens included in API requests --> - <meta-data - android:name="com.mapbox.EnableSkuToken" - android:value="true" /> - </application> </manifest>
\ No newline at end of file |