Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add a phone number to existing contact #106

Open
JoyHong opened this issue Apr 11, 2023 · 9 comments
Open

How to add a phone number to existing contact #106

JoyHong opened this issue Apr 11, 2023 · 9 comments

Comments

@JoyHong
Copy link

JoyHong commented Apr 11, 2023

please help me, thanks

@cjltgb520
Copy link

I also have this requirement. Have you solved it?

@joachim-quis
Copy link
Contributor

Hi, what do you call "device view"?

@JoyHong JoyHong changed the title How to add a phone number to existing contact via device view How to add a phone number to existing contact May 27, 2024
@JoyHong
Copy link
Author

JoyHong commented May 27, 2024

Hi, what do you call "device view"?

Sorry for my mistake,I means how to add a new phone number to existing contact?Is this library support it?

Very thanks

@joachim-quis
Copy link
Contributor

You first need the contact ID. Then:

final contactId = '.....';
Contact contact = await FlutterContacts.getContact(contactId);
contact.phones.add(Phone('555-123-4567'));
await contact.update();

@JoyHong
Copy link
Author

JoyHong commented May 27, 2024

You first need the contact ID. Then:

final contactId = '.....';
Contact contact = await FlutterContacts.getContact(contactId);
contact.phones.add(Phone('555-123-4567'));
await contact.update();

Is there another way to add existing contact? eg. open contacts app,and auto fill phone number to an existing contact。

@joachim-quis
Copy link
Contributor

I doubt you can autofill a phone number and pass it through the default contact app.

You can always use:

await FlutterContacts.openExternalView(contact.id);

or

await FlutterContacts.openExternalEdit(contact.id);

@JoyHong
Copy link
Author

JoyHong commented May 28, 2024

I doubt you can autofill a phone number and pass it through the default contact app.

You can always use:

await FlutterContacts.openExternalView(contact.id);

or

await FlutterContacts.openExternalEdit(contact.id);

em... my question is how to autofill phone number...

@joachim-quis
Copy link
Contributor

Ah. In this case you can use:

final contact = Contact()..phones = [Phone('555-123-4567')];
await FlutterContacts.openExternalInsert(contact);

@joachim-quis
Copy link
Contributor

But if this is for an existing contact, indeed, that is currently not possible. I'll reopen this as a feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants