forked from organicmaps/organicmaps
[android] Added logging of all entry points to the app
This commit is contained in:
parent
b7e0413ca5
commit
a9b5a7bfcf
7 changed files with 73 additions and 3 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue