public final class

ContactManager

extends Object
java.lang.Object
   ↳ com.neomades.contact.ContactManager

Class Overview

This class allows to manage contacts in the phone's address book through the device contact interface.

To use this class, the WRITE_CONTACTS, READ_CONTACTS and GET_ACCOUNTS permissions must be declared in the URS file.

Get this object by calling the static method getDefault().

Summary

Public Methods
void addContact(ContactResultListener resultListener)
Open a native contact creation page.
void addContact(Contact contact, ContactResultListener resultListener)
Open a native contact creation page with prefilled fields.
void addContact()
Open a native contact creator page.
void addContact(Contact contact)
Open a native contact creator page with prefilled fields.
void editContact(Contact contact)
Open a native contact editor page.
void editContact(Contact contact, ContactResultListener resultListener)
Open a native contact editor page.
static ContactManager getDefault()
Returns the default instance of ContactManager.
void pickSingleContact(ContactResultListener resultListener)
Open a native contact picker page.
void showContact(Contact contact)
Open a native page that display contact information.
void showContact(Contact contact, ContactResultListener resultListener)
Open a native page that display contact information.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public void addContact (ContactResultListener resultListener)

Open a native contact creation page. The look and the content of the page is provided by the system and is platform dependent.
Application can be notified that the contact was added or not thanks to a ContactResultListener.

Limitations

In Android 4.0 (API version 14), a problem in the new version of contacts app causes incorrect navigation.
When your app sends an insert intent to the contacts app and users fill and save a contact, they will see the contact details screen (instead of going back to your app).
To navigate back to your app, they have to click back button (but the contact application will not return any data).
This issue is fixed in Android 4.0.3 (API version 15) and later.

Parameters
resultListener callback to listen result of contact creation

public void addContact (Contact contact, ContactResultListener resultListener)

Open a native contact creation page with prefilled fields.
The fields that can be prefilled are : First Name, Phone Number, E-Mail, Postal Address, Company and Job Title. The look and the content of the page is provided by the system and is platform dependent.
Application can be notified that the contact was added or not thanks to a ContactResultListener.

Limitations

In Android 4.0 (API version 14), a problem in the new version of contacts app causes incorrect navigation.
When your app sends an insert intent to the contacts app and users fill and save a contact, they will see the contact details screen (instead of going back to your app).
To navigate back to your app, they have to click back button (but the contact application will not return any data).
This issue is fixed in Android 4.0.3 (API version 15) and later.

Parameters
contact a Contact object used to prefilled creator page fields. If Contact object is null, it shows an empty form.
resultListener callback to listen result of contact creation

public void addContact ()

Open a native contact creator page. The look and the content of the page is provided by the system and is platform dependent.

Limitations

In Android 4.0 (API version 14), a problem in the new version of contacts app causes incorrect navigation.
When your app sends an insert intent to the contacts app and users fill and save a contact, they will see the contact details screen (instead of going back to your app).
To navigate back to your app, they have to click back button (but the contact application will not return any data).
This issue is fixed in Android 4.0.3 (API version 15) and later.

public void addContact (Contact contact)

Open a native contact creator page with prefilled fields.
The fields that can be prefilled are : First Name, Phone Number, E-Mail, Postal Address, Company and Job Title.
The look and the content of the page is provided by the system and is platform dependent.

Limitations

In Android 4.0 (API version 14), a problem in the new version of contacts app causes incorrect navigation.
When your app sends an insert intent to the contacts app and users fill and save a contact, they will see the contact details screen (instead of going back to your app).
To navigate back to your app, they have to click back button (but the contact application will not return any data).
This issue is fixed in Android 4.0.3 (API version 15) and later.

Parameters
contact a Contact object used to prefilled creator page fields. If Contact object is null, it shows an empty form.

public void editContact (Contact contact)

Open a native contact editor page.
This page will allow a user to modify an existing contact.
The look and the content of the page is provided by the system and is platform dependent.

Limitations

From Android 4.0 (API version 14), a problem in the new version of contacts app causes incorrect navigation.
When your app sends an edit intent to the contacts app and users edit and save a contact, they will see the contact details screen (instead of going back to your app).
To navigate back to your app, they have to click back button (but the contact application will not return any data).
This issue is fixed in Android 4.0.3 (API version 15) and later.

Parameters
contact a Contact object representing the contact to modify. If Contact object is null, it does nothing.

public void editContact (Contact contact, ContactResultListener resultListener)

Open a native contact editor page. This page will allow a user to modify an existing contact. Application can be notified that the contact was modified or not thanks to a ContactResultListener.
The look and the content of the page is provided by the system and is platform dependent.

Limitations

From Android 4.0 (API version 14), a problem in the new version of contacts app causes incorrect navigation.
When your app sends an edit intent to the contacts app and users edit and save a contact, they will see the contact details screen (instead of going back to your app).
To navigate back to your app, they have to click back button (but the contact application will not return any data).
This issue is fixed in Android 4.0.3 (API version 15) and later.

Cross Platform Considerations

On iOS the ContactResultListener is never called.

Parameters
contact a Contact object representing the contact to modify. If Contact object is null, it does nothing.
resultListener callback to listen result of contact edition

public static ContactManager getDefault ()

Returns the default instance of ContactManager.

Returns
  • the default instance of ContactManager
Throws
SecurityException if one of the three permissions to access contacts (WRITE_CONTACTS, READ_CONTACTS or GET_ACCOUNTS) is missing.

public void pickSingleContact (ContactResultListener resultListener)

Open a native contact picker page. This page will allow a user to select a contact among all the contacts of the device.
The look and the content of the page is provided by the system and is platform dependent.

Parameters
resultListener callback to listen result of "single contact" picker operation (can be null)

public void showContact (Contact contact)

Open a native page that display contact information.
The look and the content of the page is provided by the system and is platform dependent.

Parameters
contact a Contact object representing the contact to display. If Contact object is null, it does nothing.

public void showContact (Contact contact, ContactResultListener resultListener)

Open a native page that display contact information. Application can be notified that the contact was displayed thanks to a ContactResultListener.
The look and the content of the page is provided by the system and is platform dependent.

Parameters
contact a Contact object representing the contact to display. If Contact object is null, it does nothing.
resultListener callback to listen result of contact display