diff --git a/src/main/java/com/marianhello/bgloc/sync/BatchManager.java b/src/main/java/com/marianhello/bgloc/sync/BatchManager.java index 88d10611..1f108b69 100644 --- a/src/main/java/com/marianhello/bgloc/sync/BatchManager.java +++ b/src/main/java/com/marianhello/bgloc/sync/BatchManager.java @@ -57,7 +57,7 @@ private Uri getLocationContentUri() { private File createBatchFromTemplate(Long batchStartMillis, Integer syncThreshold, LocationTemplate template) throws IOException { logger.info("Creating batch {}", batchStartMillis); - ContentResolver resolver = context.getApplicationContext().getContentResolver(); + ContentResolver resolver = context.getContentResolver(); Uri contentUri = getLocationContentUri(); String whereClause = TextUtils.join("", new String[]{ diff --git a/src/preoreo/java/com/marianhello/bgloc/sync/SyncAdapter.java b/src/preoreo/java/com/marianhello/bgloc/sync/SyncAdapter.java index d8dca09c..149e4abf 100644 --- a/src/preoreo/java/com/marianhello/bgloc/sync/SyncAdapter.java +++ b/src/preoreo/java/com/marianhello/bgloc/sync/SyncAdapter.java @@ -38,7 +38,6 @@ public class SyncAdapter extends AbstractThreadedSyncAdapter implements Uploadin private static final int NOTIFICATION_ID = 666; - ContentResolver contentResolver; private ConfigurationDAO configDAO; private NotificationManager notificationManager; private BatchManager batchManager; @@ -67,14 +66,9 @@ public SyncAdapter( super(context, autoInitialize); logger = LoggerManager.getLogger(SyncAdapter.class); - /* - * If your app uses a content resolver, get an instance of it - * from the incoming Context - */ - contentResolver = context.getContentResolver(); configDAO = DAOFactory.createConfigurationDAO(context); - batchManager = new BatchManager(this.getContext()); - notificationManager = (NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE); + batchManager = new BatchManager(context); + notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationHelper.registerSyncChannel(context); }