diff --git a/android/src/com/mapswithme/maps/background/ConnectivityChangedReceiver.java b/android/src/com/mapswithme/maps/background/ConnectivityChangedReceiver.java index 547516a353..b0d4a0664a 100644 --- a/android/src/com/mapswithme/maps/background/ConnectivityChangedReceiver.java +++ b/android/src/com/mapswithme/maps/background/ConnectivityChangedReceiver.java @@ -3,22 +3,33 @@ package com.mapswithme.maps.background; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.util.Log; +import com.crashlytics.android.Crashlytics; import com.mapswithme.maps.MwmApplication; import com.mapswithme.maps.downloader.MapManager; import com.mapswithme.util.ConnectionState; import com.mapswithme.util.PermissionsUtils; +import com.mapswithme.util.log.Logger; +import com.mapswithme.util.log.LoggerFactory; +import static com.mapswithme.maps.MwmApplication.backgroundTracker; import static com.mapswithme.maps.MwmApplication.prefs; public class ConnectivityChangedReceiver extends BroadcastReceiver { + private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC); + private static final String TAG = ConnectivityChangedReceiver.class.getSimpleName(); private static final String DOWNLOAD_UPDATE_TIMESTAMP = "DownloadOrUpdateTimestamp"; private static final long MIN_EVENT_DELTA_MILLIS = 3 * 60 * 60 * 1000; // 3 hours @Override public void onReceive(Context context, Intent intent) { + String msg = "onReceive: " + intent + " app in background = " + + !backgroundTracker().isForeground(); + LOGGER.i(TAG, msg); + Crashlytics.log(Log.INFO, TAG, msg); if (!PermissionsUtils.isExternalStorageGranted()) return; diff --git a/android/src/com/mapswithme/maps/background/UpgradeReceiver.java b/android/src/com/mapswithme/maps/background/UpgradeReceiver.java index 3a72250e53..35e332cf53 100644 --- a/android/src/com/mapswithme/maps/background/UpgradeReceiver.java +++ b/android/src/com/mapswithme/maps/background/UpgradeReceiver.java @@ -3,14 +3,26 @@ package com.mapswithme.maps.background; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.util.Log; +import com.crashlytics.android.Crashlytics; import com.mapswithme.maps.MwmApplication; +import com.mapswithme.util.log.Logger; +import com.mapswithme.util.log.LoggerFactory; + +import static com.mapswithme.maps.MwmApplication.backgroundTracker; public class UpgradeReceiver extends BroadcastReceiver { + private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC); + private static final String TAG = UpgradeReceiver.class.getSimpleName(); @Override public void onReceive(Context context, Intent intent) { + String msg = "onReceive: " + intent + " app in background = " + + !backgroundTracker().isForeground(); + LOGGER.i(TAG, msg); + Crashlytics.log(Log.INFO, TAG, msg); MwmApplication.onUpgrade(); } } diff --git a/android/src/com/mapswithme/maps/background/WorkerService.java b/android/src/com/mapswithme/maps/background/WorkerService.java index cdea7bf072..43d6ca4bb0 100644 --- a/android/src/com/mapswithme/maps/background/WorkerService.java +++ b/android/src/com/mapswithme/maps/background/WorkerService.java @@ -6,7 +6,9 @@ import android.content.Intent; import android.content.SharedPreferences; import android.location.Location; import android.text.TextUtils; +import android.util.Log; +import com.crashlytics.android.Crashlytics; import com.mapswithme.maps.MwmApplication; import com.mapswithme.maps.R; import com.mapswithme.maps.downloader.CountryItem; @@ -15,11 +17,15 @@ import com.mapswithme.maps.editor.Editor; import com.mapswithme.maps.location.LocationHelper; import com.mapswithme.util.PermissionsUtils; import com.mapswithme.util.concurrency.UiThread; +import com.mapswithme.util.log.Logger; +import com.mapswithme.util.log.LoggerFactory; import java.util.concurrent.CountDownLatch; public class WorkerService extends IntentService { + private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC); + private static final String TAG = WorkerService.class.getSimpleName(); private static final String ACTION_CHECK_LOCATIION = "com.mapswithme.maps.action.check_location"; private static final String ACTION_UPLOAD_OSM_CHANGES = "com.mapswithme.maps.action.upload_osm_changes"; @@ -56,8 +62,11 @@ public class WorkerService extends IntentService { if (intent != null) { + String msg = "onHandleIntent: " + intent + " app in background = " + + !MwmApplication.backgroundTracker().isForeground(); + LOGGER.i(TAG, msg); + Crashlytics.log(Log.INFO, TAG, msg); final String action = intent.getAction(); - switch (action) { case ACTION_CHECK_LOCATIION: diff --git a/android/src/com/mapswithme/maps/location/GPSCheck.java b/android/src/com/mapswithme/maps/location/GPSCheck.java index f3a9c9e2b3..233fe9b9a8 100644 --- a/android/src/com/mapswithme/maps/location/GPSCheck.java +++ b/android/src/com/mapswithme/maps/location/GPSCheck.java @@ -5,11 +5,20 @@ import android.content.Context; import android.content.Intent; import com.mapswithme.maps.MwmApplication; +import com.mapswithme.util.log.Logger; +import com.mapswithme.util.log.LoggerFactory; + +import static com.mapswithme.maps.MwmApplication.backgroundTracker; public class GPSCheck extends BroadcastReceiver { + private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.LOCATION); + private static final String TAG = GPSCheck.class.getSimpleName(); @Override public void onReceive(Context context, Intent intent) { + String msg = "onReceive: " + intent + " app in background = " + + !backgroundTracker().isForeground(); + LOGGER.i(TAG, msg); if (MwmApplication.get().arePlatformAndCoreInitialized() && MwmApplication.backgroundTracker().isForeground()) { LocationHelper.INSTANCE.restart(); diff --git a/android/src/com/mapswithme/maps/location/TrackRecorderWakeReceiver.java b/android/src/com/mapswithme/maps/location/TrackRecorderWakeReceiver.java index ced9ab0614..d14907925a 100644 --- a/android/src/com/mapswithme/maps/location/TrackRecorderWakeReceiver.java +++ b/android/src/com/mapswithme/maps/location/TrackRecorderWakeReceiver.java @@ -3,12 +3,25 @@ package com.mapswithme.maps.location; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.util.Log; + +import com.crashlytics.android.Crashlytics; +import com.mapswithme.util.log.Logger; +import com.mapswithme.util.log.LoggerFactory; + +import static com.mapswithme.maps.MwmApplication.backgroundTracker; public class TrackRecorderWakeReceiver extends BroadcastReceiver { + private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC); + private static final String TAG = TrackRecorderWakeReceiver.class.getSimpleName(); @Override public void onReceive(Context context, Intent intent) { + String msg = "onReceive: " + intent + " app in background = " + + !backgroundTracker().isForeground(); + LOGGER.i(TAG, msg); + Crashlytics.log(Log.INFO, TAG, msg); TrackRecorder.onWakeAlarm(); } } diff --git a/android/src/com/mapswithme/maps/location/TrackRecorderWakeService.java b/android/src/com/mapswithme/maps/location/TrackRecorderWakeService.java index a9330d42d5..b2db3b56e1 100644 --- a/android/src/com/mapswithme/maps/location/TrackRecorderWakeService.java +++ b/android/src/com/mapswithme/maps/location/TrackRecorderWakeService.java @@ -3,10 +3,12 @@ package com.mapswithme.maps.location; import android.app.IntentService; import android.content.Intent; import android.support.v4.content.WakefulBroadcastReceiver; +import android.util.Log; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import com.crashlytics.android.Crashlytics; import com.mapswithme.maps.MwmApplication; import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.LoggerFactory; @@ -27,7 +29,10 @@ public class TrackRecorderWakeService extends IntentService @Override protected final void onHandleIntent(Intent intent) { - LOGGER.d(TAG, "SVC.onHandleIntent()"); + String msg = "onHandleIntent: " + intent + " app in background = " + + !MwmApplication.backgroundTracker().isForeground(); + LOGGER.i(TAG, msg); + Crashlytics.log(Log.INFO, TAG, msg); synchronized (sLock) { diff --git a/android/src/com/mapswithme/util/MultipleTrackerReferrerReceiver.java b/android/src/com/mapswithme/util/MultipleTrackerReferrerReceiver.java index 17c62ecf33..f72af4a876 100644 --- a/android/src/com/mapswithme/util/MultipleTrackerReferrerReceiver.java +++ b/android/src/com/mapswithme/util/MultipleTrackerReferrerReceiver.java @@ -3,19 +3,30 @@ package com.mapswithme.util; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.util.Log; -import com.mapswithme.maps.MwmApplication; +import com.crashlytics.android.Crashlytics; +import com.mapswithme.util.log.Logger; +import com.mapswithme.util.log.LoggerFactory; import com.mapswithme.util.statistics.AlohaHelper; import com.my.tracker.campaign.CampaignReceiver; +import static com.mapswithme.maps.MwmApplication.backgroundTracker; + /** * Custom broadcast receiver to send intent to MyTracker & Alohalytics at the same time */ public class MultipleTrackerReferrerReceiver extends BroadcastReceiver { + private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC); + private static final String TAG = MultipleTrackerReferrerReceiver.class.getSimpleName(); @Override public void onReceive(Context context, Intent intent) { + String msg = "onReceive: " + intent + " app in background = " + + !backgroundTracker().isForeground(); + LOGGER.i(TAG, msg); + Crashlytics.log(Log.INFO, TAG, msg); Counters.initCounters(context); // parse & send referrer to Aloha try