|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vodafone360.people.engine.contactsync.NativeContactsApi
public abstract class NativeContactsApi
Class that provides an abstraction layer for accessing the Native Contacts API. The underlying API to be used should be the most suitable for the SDK version of the device.
Nested Class Summary | |
---|---|
static class |
NativeContactsApi.Account
This Account class represents an available account on the device where the native synchronization can be performed. |
static interface |
NativeContactsApi.ContactsObserver
The Observer interface to receive notifications about changes in the native address book. |
Field Summary | |
---|---|
protected Context |
mContext
Context to be used by the Instance |
protected ContentResolver |
mCr
ContentResolver be used by the Instance |
protected boolean |
mHaveReadOrganization
Sadly have to have this so that only one organization may be read from a NAB Contact |
protected int |
mMarkedOrganizationIndex
Sadly have to have this because Organization detail is split into two details in CAB |
protected int |
mMarkedTitleIndex
Sadly have to have this because Organization detail is split into two details in CAB |
protected static java.lang.String |
PEOPLE_ACCOUNT_TYPE
Account type for 360 People in the Native Accounts. |
private static NativeContactsApi |
sInstance
NativeContactsApi the singleton instance providing access to the correct Contacts API interface |
Constructor Summary | |
---|---|
NativeContactsApi()
|
Method Summary | |
---|---|
abstract ContactChange[] |
addContact(NativeContactsApi.Account account,
ContactChange[] ccList)
Adds a contact. |
abstract boolean |
addPeopleAccount(java.lang.String username)
Adds the currently logged in user account to the NAB accounts. |
static void |
createInstance(Context context)
Create NativeContactsApi singleton instance for later usage. |
static void |
destroyInstance()
Destroy NativeContactsApi singleton instance if created. |
abstract NativeContactsApi.Account[] |
getAccounts()
Fetches all the existing Accounts on the device. |
abstract NativeContactsApi.Account[] |
getAccountsByType(java.lang.String type)
Fetches all the existing Accounts on the device corresponding to the provided Type Only supported on 2.X. |
abstract ContactChange[] |
getContact(long nabContactId)
Gets data for one Contact. |
abstract long[] |
getContactIds(NativeContactsApi.Account account)
Retrieves a list of contact IDs for a specific account. |
static NativeContactsApi |
getInstance()
Retrieves singleton instance providing access to the native contacts api. |
protected abstract void |
initialize()
Method meant to be called only just after createInstance() is invoked. |
abstract boolean |
isKeySupported(int key)
Checks whether or not a ContactChange key is supported. |
abstract boolean |
isPeopleAccountCreated()
Checks if there is a People Account in the NAB Accounts. |
abstract void |
registerObserver(NativeContactsApi.ContactsObserver observer)
Registers a content observer. |
abstract void |
removeContact(long nabContactId)
Removes a contact |
abstract void |
removePeopleAccount()
Removes the (first found) People Account from the NAB accounts. |
abstract void |
unregisterObserver()
Unregister the previously registered content observer. |
abstract ContactChange[] |
updateContact(ContactChange[] ccList)
Updates an existing contact. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String PEOPLE_ACCOUNT_TYPE
private static NativeContactsApi sInstance
NativeContactsApi
the singleton instance providing access to the correct Contacts API interface
protected Context mContext
Context
to be used by the Instance
protected ContentResolver mCr
ContentResolver
be used by the Instance
protected boolean mHaveReadOrganization
protected int mMarkedOrganizationIndex
protected int mMarkedTitleIndex
Constructor Detail |
---|
public NativeContactsApi()
Method Detail |
---|
public static void createInstance(Context context)
context
- The context to be used by the singletongetInstance()
,
destroyInstance()
public static void destroyInstance()
NativeContactsApi#createInstance()
public static NativeContactsApi getInstance()
NativeContactsApi
appropriate subclass instantiationprotected abstract void initialize()
public abstract void registerObserver(NativeContactsApi.ContactsObserver observer)
observer
- ContactsObserver currently observing native address book changes
java.lang.RuntimeException
- if a new observer is being registered without having unregistered the previous onepublic abstract void unregisterObserver()
public abstract NativeContactsApi.Account[] getAccounts()
public abstract NativeContactsApi.Account[] getAccountsByType(java.lang.String type)
type
- The Type of Account to fetch
public abstract boolean addPeopleAccount(java.lang.String username)
public abstract boolean isPeopleAccountCreated()
public abstract void removePeopleAccount()
public abstract long[] getContactIds(NativeContactsApi.Account account)
account
- The account to get contact IDs from (may be null)
public abstract ContactChange[] getContact(long nabContactId)
nabContactId
- Native ID for the contact
ContactChange
array with contact's data or nullpublic abstract ContactChange[] addContact(NativeContactsApi.Account account, ContactChange[] ccList)
account
- Account to be associated with the added contact (may be null).ccList
- The Contact data as a ContactChange
array
ContactChange
array with contact's new ID data or null in case of failure.public abstract ContactChange[] updateContact(ContactChange[] ccList)
ccList
- The Contact update data as a ContactChange
array
ContactChange
array with the contact's new ID data or nullpublic abstract void removeContact(long nabContactId)
nabContactId
- Native ID of the contact to removepublic abstract boolean isKeySupported(int key)
ContactChange
key is supported.
Results may vary in 1.X and 2.X
key
- Key to check for support
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaDoc