adb:在不重新启动android设备的情况下更新/重新扫描联系人 [英] adb: Update/rescan contacts without restarting the android device
本文介绍了adb:在不重新启动android设备的情况下更新/重新扫描联系人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用以下命令直接通过db加载联系人。
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/
但是,我必须重新启动设备(尝试使用多部Android手机),然后才能更新联系人。
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?
由于项目要求,我无法使用任何第三方应用程序。最好的解决方案是通过adb或类似的命令行工具。
I cannot use any third party app due to project requirements. Preferable solution would be via adb or similar command line tools.
致谢,
Rumit
Regards, Rumit
推荐答案
最终得到了答案。
这是一个4步过程。
# 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
这篇关于adb:在不重新启动android设备的情况下更新/重新扫描联系人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文