summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Leege <bleege@gmail.com>2016-04-07 11:12:52 -0500
committerBrad Leege <bleege@gmail.com>2016-04-07 12:23:51 -0500
commit1f35112a2e9f3640dea0ad8b8a1f02048607c81b (patch)
tree90412996e542116abd5392d24411819a0d1911e6
parentce0ba5f4d752877ea06c87f2066f6ff753d6563d (diff)
downloadqtlocation-mapboxgl-1f35112a2e9f3640dea0ad8b8a1f02048607c81b.tar.gz
[android] #4629 - Increasing event flush to 3 minutes to mirror iOS and clearing events when connectivity check fails
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/MapboxEventManager.java7
1 files changed, 5 insertions, 2 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 f3469459fc..f1bd5fb16a 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
@@ -82,7 +82,7 @@ public class MapboxEventManager {
private long mapboxSessionIdLastSet = 0;
private static long hourInMillis = 1000 * 60 * 60;
private static long flushDelayInitialInMillis = 1000 * 10; // 10 Seconds
- private static long flushDelayInMillis = 1000 * 60 * 2; // 2 Minutes
+ private static long flushDelayInMillis = 1000 * 60 * 3; // 3 Minutes
private static final int SESSION_ID_ROTATION_HOURS = 24;
private static MessageDigest messageDigest = null;
@@ -536,7 +536,10 @@ public class MapboxEventManager {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
if (networkInfo == null || !networkInfo.isConnected()) {
- Log.w(TAG, "Not connected to network, so returning without attempting to send events");
+ Log.w(TAG, "Not connected to network, so empty events cache and return without attempting to send events");
+ // Make sure that events don't pile up when Offline
+ // and thus impact available memory over time.
+ events.removeAllElements();
return null;
}