Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a contact via adb or monkeyrunner

Does anyone know if there is a way to add a contact via adb or monkeyrunner?

Using

device.shell("am start -a android.intent.action.ACTION_INSERT -t ContactsContract.Contacts.CONTENT_TYPE -e ContactsContract.Intents.Insert.NAME "+name+" ContactsContract.Intents.Insert.PHONE "+number)

does not work for me

like image 689
n8schloss Avatar asked Jun 18 '11 00:06

n8schloss


People also ask

How do I add contacts in adb?

Try adb shell input keyevent 3 This will take your phone back to the home screen which will automatically save the contact. Save this answer.

Can I use adb on Android?

Enable adb debugging on your deviceTo use adb with a device connected over Wi-Fi, see Connect to a device over Wi-Fi. On Android 4.2 and higher, the Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number seven times.

How do you dial a number with adb command?

To dial (not call) a number from ADB, open a terminal or command prompt window on your Linux or Windows machine and run the following ADB shell command. $ adb shell service call phone 1 s16 "+6512345678" Result: Parcel(00000000 '....') Modify the number “ +6512345678 ” with the number that you want to dial.


1 Answers

Use something like this:

device.shell("am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Donald Duck' -e phone 555-1234")
like image 121
Diego Torres Milano Avatar answered Sep 24 '22 01:09

Diego Torres Milano