Sync Intent

From dmfswiki
Jump to: navigation, search

Since CardDAV-Sync 0.4.15 and CalDAV-Sync 0.4.28 there is support for the ACTION_SYNC Intent.

The apps have an invisible activity that you can launch by sending an ACTION_SYNC Intent. The activity will trigger the synchronization and return immediately.

This is useful to trigger a sync from another app.

From Android Java code that looks like so:

Intent intent = new Intent(Intent.ACTION_SYNC);
intent.setPackage(APP_PACKAGE);
intent.putExtra("account", new Account(ACCOUNT_NAME, ACCOUNT_TYPE)); // optional
context.startActivity(intent);

The account extra is optional. If missing the app will sync all accounts. If present, the account must be a valid account managed be the app this request is sent to.

Below you'll find a matrix of valid account type and package names for the apps.

App App Package Account type
CalDAV-Sync org.dmfs.caldav.lib org.dmfs.caldav.account
CardDAV-Sync org.dmfs.carddav.Sync org.dmfs.carddav.account
CardDAV-Sync free org.dmfs.carddav.sync org.dmfs.carddav.account