Search code examples
androidandroid-contactsmonkeyrunner

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


Solution

  • 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")