Konubinix' opinionated web of thoughts

Sync Davx5(davdroid) From Adb

Fleeting

clk android adb shell dumpsys account |gi davdroid|gi name
Account {name=sam, type=bitfire.at.davdroid}
Account {name=contacts (sam Kw), type=at.bitfire.davdroid.address_book}
clk android adb shell pm grant at.bitfire.davdroid android.permission.WRITE_CONTACTS
clk android adb shell pm grant at.bitfire.davdroid android.permission.READ_CONTACTS
clk android adb shell content insert --uri content://com.android.contacts --bind account_type:s:bitfire.at.davdroid --bind account_name:s:sam 2>&1
Error while accessing provider:com.android.contacts
java.lang.UnsupportedOperationException: URI: content://com.android.contacts, calling user: android.uid.shell:2000, calling package:com.android.shell
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:174)
	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
	at android.content.ContentProviderProxy.insert(ContentProviderNative.java:549)
	at com.android.commands.content.Content$InsertCommand.onExecute(Content.java:565)
	at com.android.commands.content.Content$Command.execute(Content.java:521)
	at com.android.commands.content.Content.main(Content.java:727)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)
clk android adb shell am broadcast -a android.content.sync.SYNC_NOW -p at.bitfire.davdroid
Broadcasting: Intent { act=android.content.sync.SYNC_NOW flg=0x400000 pkg=at.bitfire.davdroid }
Broadcast completed: result=0

But does nothing

clk android adb shell am startservice -n at.bitfire.davdroid/.sync.SyncAdapterService 2>&1
Starting service: Intent { cmp=at.bitfire.davdroid/.sync.SyncAdapterService }
Error: Not found; no service started.
clk android adb shell "sync"

still does nothing

clk android adb shell "am startservice -n at.bitfire.davdroid/.sync.SyncAdapterService --es accountName sam" 2>&1
Starting service: Intent { cmp=at.bitfire.davdroid/.sync.SyncAdapterService (has extras) }
Error: Not found; no service started.

There’s a dynamic shortcut of the AccountsActivity that delivers an “sync all” Intent. You can do the same with

adb shell am start -a android.intent.action.SYNC at.bitfire.davdroid/.ui.AccountsActivity But this will bring DAVx5 to the foreground and there’s no guarantee that this will work forever.

https://github.com/bitfireAT/davx5-ose/discussions/246

clk android adb shell am start -a android.intent.action.SYNC at.bitfire.davdroid/.ui.AccountsActivity