re-enable contact sync by default

This commit is contained in:
Dominik Schürmann
2015-11-23 23:27:01 +01:00
parent 01b89d1d9c
commit dfed60f442
2 changed files with 3 additions and 7 deletions

View File

@@ -152,7 +152,7 @@ public class ContactSyncAdapterService extends Service {
extras);
}
public static void initContactsSync(Context context) {
public static void enableContactsSync(Context context) {
try {
AccountManager manager = AccountManager.get(context);
Account[] accounts = manager.getAccountsByType(Constants.ACCOUNT_TYPE);
@@ -165,11 +165,7 @@ public class ContactSyncAdapterService extends Service {
}
ContentResolver.setIsSyncable(account, ContactsContract.AUTHORITY, 1);
// Enable by default for Android < 6, on Android >= 6 runtime permissions are required
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
ContentResolver.setSyncAutomatically(account, ContactsContract.AUTHORITY, true);
}
ContentResolver.setSyncAutomatically(account, ContactsContract.AUTHORITY, true);
} catch (SecurityException e) {
Log.e(Constants.TAG, "SecurityException when adding the account", e);
Toast.makeText(context, R.string.reinstall_openkeychain, Toast.LENGTH_LONG).show();