Skip to content

Commit 0628b1b

Browse files
ashishkumar468maskaravivek
authored andcommitted
bug fix sync service (commons-app#3069)
1 parent cd57552 commit 0628b1b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

app/src/main/AndroidManifest.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@
152152
</service>
153153
<service
154154
android:name=".contributions.ContributionsSyncService"
155-
android:exported="true">
155+
android:exported="true"
156+
android:process=":sync">
156157
<intent-filter>
157158
<action android:name="android.content.SyncAdapter" />
158159
</intent-filter>

app/src/main/java/fr/free/nrw/commons/contributions/MainActivity.java

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.annotation.SuppressLint;
44
import android.app.AlertDialog;
5+
import android.content.ContentResolver;
56
import android.content.Intent;
67
import android.os.Bundle;
78
import android.view.LayoutInflater;
@@ -103,6 +104,8 @@ protected void onSaveInstanceState(Bundle outState) {
103104
}
104105

105106
private void initMain() {
107+
//Do not remove this, this triggers the sync service
108+
ContentResolver.setSyncAutomatically(sessionManager.getCurrentAccount(),BuildConfig.CONTRIBUTION_AUTHORITY,true);
106109
requestSync(sessionManager.getCurrentAccount(), BuildConfig.CONTRIBUTION_AUTHORITY, new Bundle());
107110
uploadServiceIntent = new Intent(this, UploadService.class);
108111
uploadServiceIntent.setAction(UploadService.ACTION_START_SERVICE);

0 commit comments

Comments
 (0)