|
@@ -168,13 +168,13 @@ public class FileObserverService extends Service {
|
|
|
return Service.START_STICKY;
|
|
|
|
|
|
} else if (ACTION_ADD_OBSERVED_FILE.equals(intent.getAction())) {
|
|
|
- OCFile file = (OCFile) intent.getParcelableExtra(ARG_FILE);
|
|
|
- Account account = (Account) intent.getParcelableExtra(ARG_ACCOUNT);
|
|
|
+ OCFile file = intent.getParcelableExtra(ARG_FILE);
|
|
|
+ Account account = intent.getParcelableExtra(ARG_ACCOUNT);
|
|
|
addObservedFile(file, account);
|
|
|
|
|
|
} else if (ACTION_DEL_OBSERVED_FILE.equals(intent.getAction())) {
|
|
|
- removeObservedFile((OCFile) intent.getParcelableExtra(ARG_FILE),
|
|
|
- (Account) intent.getParcelableExtra(ARG_ACCOUNT));
|
|
|
+ removeObservedFile(intent.getParcelableExtra(ARG_FILE),
|
|
|
+ intent.getParcelableExtra(ARG_ACCOUNT));
|
|
|
|
|
|
} else {
|
|
|
Log_OC.e(TAG, "Unknown action received; ignoring it: " + intent.getAction());
|
|
@@ -193,6 +193,10 @@ public class FileObserverService extends Service {
|
|
|
private void startObservation() {
|
|
|
Log_OC.d(TAG, "Loading all kept-in-sync files from database to start watching them");
|
|
|
|
|
|
+ if (MainApp.getAppContext() == null) {
|
|
|
+ MainApp.setAppContext(getApplicationContext());
|
|
|
+ }
|
|
|
+
|
|
|
// query for any favorite file in any OC account
|
|
|
Cursor cursorOnKeptInSync = getContentResolver().query(
|
|
|
ProviderTableMeta.CONTENT_URI,
|