I am trying to load the contacts via db directly using following commands.
adb shell rm /data/data/com.android.providers.contacts/databases/contacts2.db
adb pull /data/data/com.android.providers.contacts/databases/contacts2.db <PATH>
adb push <PATH>/contacts2.db /data/data/com.android.providers.contacts/databases/
However, I have to restart my devices(trying with multiple Android phones) before it can update the contacts.
Is there a way to get the updated contacts from the pushed/removed db (no contacts) without restarting the devices?
I cannot use any third party app due to project requirements. Preferable solution would be via adb or similar command line tools.
Regards, Rumit
Finally got the answer.
It's a 4 step process.
# Remove existing contacts from the device
adb shell rm /data/data/com.android.providers.contacts/databases/contacts2.db
# Copy the desired contacts to the device
adb push contacts2.db /data/data/com.android.providers.contacts/databases/
# Kill the contacts app
adb shell kill $(adb shell ps | grep android.process.acore | awk '{ print $2 }')
# Start the contacts app
adb shell am start -W -n CONTACTS_APP_ACTIVITY