2014-01-21 81 views
0

我想通过db直接使用以下命令加载联系人。adb:更新/重新扫描联系人而无需重新启动android设备

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手机)才能更新联系人。

有没有办法从推/删除的数据库(没有联系人)获得更新的联系人而无需重新启动设备?

由于项目需求,我无法使用任何第三方应用程序。优选的解决方案将通过adb或类似的命令行工具。

问候, Rumit

回答

-1

终于得到了答案。

这是一个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 
相关问题