My application requires an alternate contact while installing an app.When I run install & register app there are no contacts in new devices bydefault.
I have found an adb command to add an contact in contact list
adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Alternate Contact' -e phone 72xxxxxxxx
But now i am unable to delete same contact after execution .
Tried multiple combination of parameters with next command, but it is not working.
adb shell am start -a android.intent.action.DELETE -t vnd.android.cursor.dir/contact -e name 'Donald Duck' -e phone 72xxxxxxxx
Please share if there is an adb command to delete contact.
EDIT : adb shell pm clear com.android.providers.contacts
command will clear all contacts from contact list.
To delete a contact: Open Contacts and tap the contact that you want to delete. Tap Edit. Scroll Down and tap Delete Contact then tap Delete Contact again to confirm.
FAQ. Why don't I see a “Delete Contact” option? If the option to “Delete Contact” is missing, that usually means it is a linked contact and is being synced from an app like Facebook or Twitter.
adb shell pm clear com.android.providers.contacts
command will clear all contacts from a contact list.
To add contact (where're name = 'Mozart', number = '+380505005050')
$ adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name Vasya -e phone +380505005050
To edit contact (where's id = 1)
$ adb shell am start -a android.intent.action.EDIT content://com.android.contacts/contacts/1
To remove contact (where's id = 1)
$ adb shell content delete --uri content://com.android.contacts/contacts/1
To remove all contacts at once
$ adb shell pm clear com.android.providers.contacts
To view specific contact (where's id = 1)
$ adb shell am start -a android.intent.action.VIEW content://com.android.contacts/contacts/1
To list all contacts
$ adb shell content query --uri content://com.android.contacts/contacts
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With