Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/3party
diff options
context:
space:
mode:
authorAlex Zolotarev <alex@maps.me>2015-06-16 17:26:04 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:51:50 +0300
commit17768fd03ec60cfe10f16d4736702a63561a3f5a (patch)
treec2e8f76a6eb9d4a011a9af4322ddcc6fc1c489b3 /3party
parent96abca12617de4c0e4fc5f619b6319f893625439 (diff)
[alohalytics][android] Upload events only if we are connected to the network.
Diffstat (limited to '3party')
-rw-r--r--3party/Alohalytics/src/android/java/org/alohalytics/SystemInfo.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/3party/Alohalytics/src/android/java/org/alohalytics/SystemInfo.java b/3party/Alohalytics/src/android/java/org/alohalytics/SystemInfo.java
index c891246df2..efc051805f 100644
--- a/3party/Alohalytics/src/android/java/org/alohalytics/SystemInfo.java
+++ b/3party/Alohalytics/src/android/java/org/alohalytics/SystemInfo.java
@@ -63,7 +63,17 @@ public class SystemInfo {
collectIds(context);
collectDeviceDetails(context);
// Force statistics uploading because if user immediately uninstalls the app we won't even know about installation.
- Statistics.forceUpload();
+ // But do it only if we are already connected to any network.
+ try {
+ final ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ final NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
+ if (networkInfo != null && networkInfo.isConnected()) {
+ Statistics.forceUpload();
+ }
+ }
+ catch(Exception ex) {
+ handleException(ex);
+ }
}
}).start();
}