Skip to content

Commit

Permalink
context cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mauron85 committed Nov 8, 2018
1 parent b4f7688 commit 287f7ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/marianhello/bgloc/sync/BatchManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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[]{
Expand Down
10 changes: 2 additions & 8 deletions src/preoreo/java/com/marianhello/bgloc/sync/SyncAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 287f7ce

Please sign in to comment.