Is there any way to delete contact from contact list?
Asked Answered
P

3

15

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.

Puryear answered 14/1, 2016 at 8:2 Comment(2)
you should add your edit as an answer to this questionKery
@RavindraThorat thanks for the suggestion. I have added comment & accepted my answer.Puryear
P
15

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

Puryear answered 24/7, 2018 at 4:54 Comment(1)
Is there a similar way to delete a particular contact?Introjection
U
6

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 Mozart -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
Undressed answered 10/11, 2020 at 13:39 Comment(0)
A
0

In Android 13 to clear all contacts: adb shell pm clear com.samsung.android.app.contacts

Assembly answered 4/6 at 18:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.