Following this I found out how to add a contact using adb. The only thing that's bugging me is that the user has to okay/cancel the action, because a create-contact dialog appears on the screen. What I want is for the command to automatically add the contact without waiting for the approval of the user. I've already looked through this, but couldn't find a way. Does anyone know how to do this?

  • Your Android version and device ? Is it rooted? – Firelord Jan 22 '16 at 15:48
  • I have several devices available: Nexus 5, 6.0, rooted; Samsung Note 10.1 (GT-N8010), 4.4.2, rooted; Nexus S, 4.1.2, rooted; Sony Xperia Tipo ST21i, 4.0.4, rooted. Though I'm mostly interested in adding contacts on the Note, Nexus S, and the Sony – drZaius Jan 22 '16 at 16:05

For your Android 4.4.2 device the command to add a contact is (replace the Bo Lawson and #123.. to whatever you want):

adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Bo Lawson' -e phone 123456789

Now to get it to save. This is Android 4.4.2 specific. Pressing back will save it. For this you need to use key events. With Android 4.4.2 it is key event 4. You are going to need to do it at least twice. Once to exit the keyboard, the other to exit and save. If required use it again to completely exit from Contacts app.

adb shell am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'Bo Lawson' -e phone 123456789
adb shell input keyevent 4
adb shell input keyevent 4

This worked on my rooted Samsung Galaxy Tab Pro running Android 4.4.2.

Edit: I found a post on Stack Overflow which references this command.


I think there is not direct way to do that. I would recomend for you to make a simple app to insert a contact or contact list and then use it with adb. You can find an example here http://www.codeproject.com/Articles/578823/Android-Contact-Operations-Insert-Search-Delete

  • 1
    This would sound uncool, but you can consider skipping the question from answering if you think something can't be done, unless you technically and in detail explain the reason for such. Given that this site is for end-users of Android (read: we don't expect users to have any knowledge of programming an app) the recommendation you made won't be found useful to them. :) – Firelord Jan 22 '16 at 16:46
  • Thanks for the suggestion, but I didn't want to use an app for that. – drZaius Jan 23 '16 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.