Ich versuche, eine Zeit sync auszuführen, um einen Sync-Adapter. Es wird manuell, aber nicht periodisch synchronisiert. Das ist das einzige, was ich von logcat bekamFehler bei der Durchführung von periodischen Sync
Could not find class 'android.content.SyncRequest$Builder', referenced from method
com.example.user.sunshine.sync.SunshineSyncAdapter.configurePeriodicSync
Unten ist mein Code:
public static void configurePeriodicSync(Context context, int syncInterval, int flexTime) {
Account account = getSyncAccount(context);
String authority = context.getString(R.string.content_authority);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
SyncRequest request = new SyncRequest.Builder().
syncPeriodic(syncInterval, flexTime).
setSyncAdapter(account, authority).build();
ContentResolver.requestSync(request);
} else {
ContentResolver.addPeriodicSync(account,
authority, new Bundle(), syncInterval);
}
}
Weiß jemand, warum dies geschieht und wie soll ich tun, um es zu lösen?