From 0628b1b8f5a116465800fd04b3a9a07d15c6da1d Mon Sep 17 00:00:00 2001 From: Ashish Kumar Date: Sun, 14 Jul 2019 13:20:13 +0530 Subject: [PATCH] bug fix sync service (#3069) --- app/src/main/AndroidManifest.xml | 3 ++- .../java/fr/free/nrw/commons/contributions/MainActivity.java | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b2e434bd4f..3471547d32 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -152,7 +152,8 @@ + android:exported="true" + android:process=":sync"> diff --git a/app/src/main/java/fr/free/nrw/commons/contributions/MainActivity.java b/app/src/main/java/fr/free/nrw/commons/contributions/MainActivity.java index 14825657aa..90e27af33f 100644 --- a/app/src/main/java/fr/free/nrw/commons/contributions/MainActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/contributions/MainActivity.java @@ -2,6 +2,7 @@ import android.annotation.SuppressLint; import android.app.AlertDialog; +import android.content.ContentResolver; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; @@ -103,6 +104,8 @@ protected void onSaveInstanceState(Bundle outState) { } private void initMain() { + //Do not remove this, this triggers the sync service + ContentResolver.setSyncAutomatically(sessionManager.getCurrentAccount(),BuildConfig.CONTRIBUTION_AUTHORITY,true); requestSync(sessionManager.getCurrentAccount(), BuildConfig.CONTRIBUTION_AUTHORITY, new Bundle()); uploadServiceIntent = new Intent(this, UploadService.class); uploadServiceIntent.setAction(UploadService.ACTION_START_SERVICE);