mirror of https://github.com/etesync/android
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
805 B
21 lines
805 B
package com.etesync.syncadapter.syncadapter
|
|
|
|
import android.accounts.Account
|
|
import android.content.ContentResolver
|
|
import android.os.Bundle
|
|
import android.provider.CalendarContract
|
|
import at.bitfire.ical4android.TaskProvider.Companion.OPENTASK_PROVIDERS
|
|
import com.etesync.syncadapter.App
|
|
|
|
|
|
fun requestSync(account: Account?) {
|
|
val authorities = arrayOf(App.addressBooksAuthority, CalendarContract.AUTHORITY) +
|
|
OPENTASK_PROVIDERS.map { it.authority }
|
|
|
|
for (authority in authorities) {
|
|
val extras = Bundle()
|
|
extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true) // manual sync
|
|
extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true) // run immediately (don't queue)
|
|
ContentResolver.requestSync(account, authority, extras)
|
|
}
|
|
} |