diff options
author | Brad Leege <bleege@gmail.com> | 2016-06-04 20:07:56 -0500 |
---|---|---|
committer | Brad Leege <bleege@gmail.com> | 2016-06-06 10:56:55 -0500 |
commit | f4a82bd367cc5a2134f37dec9979a7d653ef965c (patch) | |
tree | 94a32da2f6fd5e448a4663ab3db8316954764b15 /platform | |
parent | 65330bda8c977e36361b1323ef1abe3b89ef6709 (diff) | |
download | qtlocation-mapboxgl-f4a82bd367cc5a2134f37dec9979a7d653ef965c.tar.gz |
[android] #5186 - Starting rotateSessionId before Telemetry Starts and ensuring that mapboxSessionId is initialized
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/MapboxEventManager.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/MapboxEventManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/MapboxEventManager.java index bf38c3233f..907e34f878 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/MapboxEventManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/MapboxEventManager.java @@ -128,6 +128,9 @@ public class MapboxEventManager { Log.w(TAG, "Error getting Encryption Algorithm: " + e); } + // Create Initial Session Id + rotateSessionId(); + SharedPreferences prefs = context.getSharedPreferences(MapboxConstants.MAPBOX_SHARED_PREFERENCES_FILE, Context.MODE_PRIVATE); // Determine if Telemetry Should Be Enabled @@ -147,9 +150,6 @@ public class MapboxEventManager { editor.commit(); } - // Create Initial Session Id - rotateSessionId(); - // Get DisplayMetrics Setup displayMetrics = new DisplayMetrics(); ((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(displayMetrics); @@ -444,7 +444,7 @@ public class MapboxEventManager { */ private void rotateSessionId() { long now = System.currentTimeMillis(); - if (now - mapboxSessionIdLastSet > (SESSION_ID_ROTATION_HOURS * hourInMillis)) { + if ((TextUtils.isEmpty(mapboxSessionId)) || (now - mapboxSessionIdLastSet > (SESSION_ID_ROTATION_HOURS * hourInMillis))) { mapboxSessionId = UUID.randomUUID().toString(); mapboxSessionIdLastSet = System.currentTimeMillis(); } |