Switch to ACTION_INSERT_OR_EDIT for "add to contacts" action

This allows adding an email address to an existing contact.
This commit is contained in:
cketti 2023-06-07 19:23:49 +02:00
parent 8015392d70
commit 23ddb37d55

View file

@ -6,8 +6,8 @@ import android.provider.ContactsContract
internal class AddToContactsLauncher {
fun launch(context: Context, name: String?, email: String) {
val intent = Intent(Intent.ACTION_INSERT).apply {
type = ContactsContract.Contacts.CONTENT_TYPE
val intent = Intent(Intent.ACTION_INSERT_OR_EDIT).apply {
type = ContactsContract.Contacts.CONTENT_ITEM_TYPE
putExtra(ContactsContract.Intents.Insert.EMAIL, email)