[android] #4629 - Increasing event flush to 3 minutes to mirror iOS and clearing events when connectivity check fails

This commit is contained in:
Brad Leege
2016-04-07 11:12:52 -05:00
parent ce0ba5f4d7
commit 1f35112a2e

View File

@@ -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;
}