The example in this article describes how to import address book contacts to the Android emulator using the ADB command. Share to everyone for your reference. The implementation methods are as follows:
Using the commands provided by ADB, you can easily import the address book from your PC into the Android emulator.
First you have to prepare a fixed-format contacts.vcf file, which is the Address Book store file in Android. The format is as follows:
Copy Code code as follows:
Begin:vcard
version:3.0
n:15200000000;;;;
TEL; type=cell:15200000000
End:vcard
Begin:vcard
version:3.0
n:15200000011;;;;
TEL; type=cell:15200000011
End:vcard
The imported commands are as follows:
Copy Code code as follows:
# clear the original address book contact first
Adb-s emulator-5554 Shell pm Clear com.android.providers.contacts
# CONTACTS.VCF The Address Book file in the correct format, import into the Android emulator, and wait for the emulator to refresh for a few seconds
Adb-s emulator-5554 Push CONTACTS.VCF/SDCARD/CONTACTS.VCF
Sleep 3
# from the file, import the contact into the Android emulator's address book, and the process will take time depending on the number of contacts.
Adb-s emulator-5554 Shell am start-t "Text/x-vcard"-D "file:///sdcard/contacts.vcf"-a Android.intent.action.VIEW COM.A Ndroid.contacts
Sleep 10
OK, if none of the above is the case, the emulator's address book adds new contact information.
I hope this article will help you with your Android program.