標籤:
使用adb命令向Android模擬器中大量匯入通訊錄連絡人的方法:
使用adb提供的命令, 可以非常方便地從PC中將通訊錄大量匯入android模擬器中.
首先要先準備好固定格式的vcf檔案, 該檔案即android中的通訊錄儲存格式檔案.
格式如下:
BEGIN:VCARDVERSION:2.1N:;Qiqi;;;FN:QiqiTEL;HOME:7474EMAIL;HOME:qiqi.comADR;HOME:;;Qiqi;;;;END:VCARDBEGIN:VCARDVERSION:2.1N:;Re;;;FN:ReTEL;HOME:73EMAIL;HOME:re.comADR;HOME:;;Re;;;;END:VCARDBEGIN:VCARDVERSION:2.1N:;Staill;;;FN:StaillTEL;HOME:782-455EMAIL;HOME:staill.comADR;HOME:;;Staill;;;;END:VCARDBEGIN:VCARDVERSION:2.1N:;Tian;;;FN:TianTEL;HOME:8426EMAIL;HOME:tian.comADR;HOME:;;Tian;;;;END:VCARDBEGIN:VCARDVERSION:2.1N:;Uuu;;;FN:UuuTEL;HOME:888EMAIL;HOME:uuu.comADR;HOME:;;Uuu;;;;END:VCARDBEGIN:VCARDVERSION:2.1N:;Victory;;;FN:VictoryTEL;HOME:842-8679EMAIL;HOME:victory.comADR;HOME:;;Victory;;;;END:VCARD
匯入的命令如下:
1 // 清除原通訊錄連絡人 2 3 adb -s emulator-5554 shell pm clear com.android.providers.contacts 4 5 6 // 將正確格式的通訊錄檔案contacts.vcf, 匯入android模擬器中, 並等待模擬器重新整理幾秒鐘 7 8 adb -s emulator-5555 push contacts.vcf /sdcard/contacts.vcf 9 10 11 // 從檔案中, 將連絡人import到android模擬器的通訊錄中, 匯入處理程序耗時依連絡人數量而定. 12 13 adb -s emulator-5554 shell am start -t "text/x-vcard" -d "file:///sdcard/contacts.vcf" -a android.intent.action.VIEW com.android.contacts
View Code
向Android模擬器中大量匯入通訊錄連絡人