Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to delete contact from contact list?

Tags:

android

adb

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.

like image 298
Chandrashekhar Swami Avatar asked Jan 14 '16 08:01

Chandrashekhar Swami


People also ask

How do I permanently delete a contact from my iPhone?

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.

Why won't my iPhone let me delete a contact?

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.


2 Answers

adb shell pm clear com.android.providers.contacts command will clear all contacts from a contact list.

like image 191
Chandrashekhar Swami Avatar answered Nov 12 '22 21:11

Chandrashekhar Swami


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
like image 3
The Mauler Avatar answered Nov 12 '22 22:11

The Mauler