Skip to content

Commit 038f1fe

Browse files
committed
Merge remote-tracking branch 'origin/beta' into bridge-merge
2 parents a073457 + ee1f30a commit 038f1fe

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

aware-core/src/main/java/com/aware/Notes.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package com.aware;
22

3+
import android.content.BroadcastReceiver;
34
import android.content.ContentResolver;
5+
import android.content.Context;
46
import android.content.Intent;
7+
import android.content.IntentFilter;
58
import android.content.SyncRequest;
69
import android.os.Bundle;
710
import android.util.Log;
811

9-
import com.aware.providers.Keyboard_Provider;
1012
import com.aware.providers.Notes_Provider;
1113
import com.aware.syncadapters.Notes_Sync;
1214
import com.aware.utils.Aware_Sensor;
@@ -34,6 +36,22 @@ public void onCreate() {
3436
Log.d(TAG, "Notes service created!");
3537
}
3638

39+
40+
private final BroadcastReceiver noteReceiver = new BroadcastReceiver() {
41+
@Override
42+
public void onReceive(Context context, Intent intent) {
43+
if (intent.getAction() != null) {
44+
switch (intent.getAction()) {
45+
case Aware.ACTION_AWARE_SYNC_DATA:
46+
Bundle sync = new Bundle();
47+
sync.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
48+
sync.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
49+
ContentResolver.requestSync(Aware.getAWAREAccount(context), Notes_Provider.AUTHORITY, sync);
50+
}
51+
}
52+
}
53+
};
54+
3755
@Override
3856
public void onDestroy() {
3957
super.onDestroy();
@@ -66,12 +84,18 @@ public int onStartCommand(Intent intent, int flags, int startId) {
6684
.setExtras(new Bundle()).build();
6785
ContentResolver.requestSync(request);
6886
}
69-
87+
registerNoteReceiver();
7088
Log.d(TAG, "Sync configured for authority: " + Notes_Provider.getAuthority(this));
7189
Log.d(TAG, "Is syncable: " + ContentResolver.getIsSyncable(Aware.getAWAREAccount(this), Notes_Provider.getAuthority(this)));
7290
Log.d(TAG, "Auto sync: " + ContentResolver.getSyncAutomatically(Aware.getAWAREAccount(this), Notes_Provider.getAuthority(this)));
7391
}
7492

7593
return START_STICKY;
7694
}
95+
96+
private void registerNoteReceiver(){
97+
IntentFilter filter = new IntentFilter();
98+
filter.addAction(Aware.ACTION_AWARE_SYNC_DATA);
99+
registerReceiver(noteReceiver, filter);
100+
}
77101
}

aware-core/src/main/java/com/aware/providers/Notes_Provider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ private Notes_Data() {}
3131

3232
public static final Uri CONTENT_URI = Uri.parse("content://"
3333
+ Notes_Provider.AUTHORITY + "/notes");
34-
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.aware.applications.notes";
35-
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.aware.applications.notes";
34+
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.aware.notes";
35+
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.aware.notes";
3636

3737
public static final String _ID = "_id";
3838
public static final String TIMESTAMP = "timestamp";

0 commit comments

Comments
 (0)