STWContact Manager
STWContactManager
Public Class that manages all operations concerning contacts in the Application. Contacts in the App can be groups or single subscribers.
This class offers several possible operations defined in the following list:
- Retreive all contacts syn/async
- Retreive all company contacts syn/async
- Retreive all SmartMs contacts syn/async
- Load contact pictures
- Find a contact by number.
- Retreive single contact details
- Retreive group contact details
- Retreive all contacts
STWContactManager.getInstance().getAllContacts(this, STWContactFilter.ALL, new STWContactManager.STWLoadContactsCallback() { public void onComplete(List<ContactItem> contactList) { // Update your RecyclerView/ListView } });Content copied to clipboard{ @code ListcontactList = STWContactManager.getInstance().getAllContacts(context, STWContactFilter.ALL); }Content copied to clipboard
- Retreive all company contacts
STWContactManager.getInstance().getCompanyContacts(this, STWContactFilter.ALL, new STWContactManager.STWLoadContactsCallback() { public void onComplete(List<ContactItem> contactList) { // Update RecyclerView } });Content copied to clipboard{ @code ListcompanyContactList = STWContactManager.getInstance().getCompanyContacts(context, STWContactFilter.ALL); }Content copied to clipboard
- Retreive all SmartMs contacts
STWContactManager.getInstance().getSmartMSContacts(this, new STWContactManager.STWLoadContactsCallback() { public void onComplete(List<ContactItem> list) { // Update RecyclerView } });Content copied to clipboard{ @code ListsmartMSContactList = STWContactManager.getInstance().getSmartMSContacts(context); }Content copied to clipboard
- Load contact pictures
STWContactManager.getInstance().loadContactPicture(context, imageView, placeHolderBitmap);Content copied to clipboard - Find a contact by number
{ @code ContactItem contact = STWContactManager.getInstance().getContactByNumber(context, number); }Content copied to clipboard - Retreive single contact details
STWContactManager.getInstance().getContactDetails(context, number, new STWContactManager.STWContactDetailsCallback(){ public void onComplete(ContactItem contact) { // code } public void onFail() { // code } });Content copied to clipboard - Retreive group contact details
STWContactManager.getInstance().getGroupDetails(context, groupId, new STWContactManager.STWGroupDetailsCallback(){ public void onComplete(List<ContactItem> contactList) { // code } public void onFail() { // code } });Content copied to clipboard - /Check if public visibility feature is enabled for current user
boolean isPublicVisibilityEnabled = STWAccountManager.getInstance().isPublicVisibilityEnabled(getContext());Content copied to clipboard
Functions
Link copied to clipboard
open fun createSearchController(@NonNull callback: STWContactSearchCallback, window: Int): STWSearchController
Content copied to clipboard
Create an instance of STWSearchController
Link copied to clipboard
open fun enableReverseContactNameDisplay(@NonNull context: Context, enabled: Boolean)
Content copied to clipboard
This method is used to enable/disable reverse display of contact name -Option enabled : contact name will be displayed like -Option disabled : contact name will be displayed like
Link copied to clipboard
open fun getAllContacts(@NonNull context: Context, filter: Int): List<ContactItem>
Content copied to clipboard
Get All contacts including visible company contacts and all SmartMs contacts
open fun getAllContacts( @NonNull context: Context, filter: Int, @Nullable loadCallback: STWLoadContactsCallback): AsyncTask
Content copied to clipboard
Async method to get All contacts including visible company contacts and all SmartMs contacts
Link copied to clipboard
open fun getAllLocalContacts(@NonNull context: Context): List<ContactItem>
Content copied to clipboard
open fun getAllLocalContacts(@NonNull context: Context, @Nullable keyWord: String): List<ContactItem>
Content copied to clipboard
Get All local contacts (smartMs and system contacts)
Link copied to clipboard
open fun getAllowedOperationalStatusList(@NonNull context: Context): List<OperationalStatusItem>
Content copied to clipboard
Get the allowed operational status list for the subscriber.
Link copied to clipboard
open fun getBusinessPhone(@NonNull context: Context, @NonNull contactItem: ContactItem): PhoneItem
Content copied to clipboard
Get the business PhoneItem related to the specified contact.
Link copied to clipboard
open fun getCompanyContacts(@NonNull context: Context, @Nullable filter: STWContactFilterOption): List<ContactItem>
Content copied to clipboard
open fun getCompanyContacts( @NonNull context: Context, @Nullable filtersList: STWContactFilterOption, @Nullable keyWord: String): List<ContactItem>
Content copied to clipboard
open fun getCompanyContacts(@NonNull context: Context, filter: Int): List<ContactItem>
Content copied to clipboard
Get only visible company contacts
open fun getCompanyContacts( @NonNull context: Context, filter: Int, @Nullable loadCallback: STWLoadContactsCallback): AsyncTask
Content copied to clipboard
Async method to get only visible company contacts
open fun getCompanyContacts( @NonNull context: Context, filter: Int, @Nullable keyWord: String): List<ContactItem>
Content copied to clipboard
Get only visible company contacts matching searchKeyWord
Link copied to clipboard
open fun getCompanyContactsForAllGroup(@NonNull context: Context): List<ContactItem>
Content copied to clipboard
Retrieve a list of business contact for all group (All single contacts without guests)
Link copied to clipboard
open fun getContactByGroupId(@NonNull context: Context, @NonNull groupId: String): ContactItem
Content copied to clipboard
Get, if exist, the ContactItem having the specified groupId
Link copied to clipboard
open fun getContactByGroupName(@NonNull context: Context, @NonNull groupName: String): ContactItem
Content copied to clipboard
Get the group contact having the specified groupName
Link copied to clipboard
open fun getContactById(@NonNull context: Context, @NonNull contactId: String): ContactItem
Content copied to clipboard
Get, if exist, the ContactItem having the specified Id
Link copied to clipboard
open fun getContactByNumber(@NonNull context: Context, @NonNull number: String): List<ContactItem>
Content copied to clipboard
Tries to find contacts by number
Link copied to clipboard
open fun getContactBySystemContactId(@NonNull context: Context, @Nullable sysContactId: String): ContactItem
Content copied to clipboard
get contactItem with systemContact
Link copied to clipboard
Call this method to get the cache lifetime to keep contact details (in seconds)
Link copied to clipboard
open fun getContactDetails( @NonNull context: Context, @NonNull phoneNumber: String, @Nullable detailsCallback: STWContactDetailsCallback): AsyncTask<String, Void, ContactItem>
Content copied to clipboard
Load the contact details asynchronously
Link copied to clipboard
open fun getContactPhones(@NonNull context: Context, @NonNull contactItem: ContactItem): List<PhoneItem>
Content copied to clipboard
Get list of phones for the specified contactItem If the specified contact is a group contact, phones are the group members.
open fun getContactPhones( @NonNull context: Context, @NonNull contactItem: ContactItem, @Nullable filtersLis: STWContactFilterOption): List<PhoneItem>
Content copied to clipboard
Link copied to clipboard
open fun getContactPictureBitmap( @NonNull context: Context, @NonNull contact: STWContact, @Nullable defaultContactIconResources: DefaultContactIconResources): Bitmap
Content copied to clipboard
open fun getContactPictureBitmap( @NonNull context: Context, @NonNull contact: ContactItem, @Nullable defaultContactIconResources: DefaultContactIconResources): Bitmap
Content copied to clipboard
Get contact picture in the imageView.
Link copied to clipboard
open fun getDefaultFilterOperationalStatus(@NonNull context: Context): String
Content copied to clipboard
Get default Operational Status Filters
Link copied to clipboard
Link copied to clipboard
open fun getDisplayNameForContactItem(@NonNull context: Context, @NonNull contactItem: ContactItem): String
Content copied to clipboard
Get get Display name for contact item
Link copied to clipboard
open fun getGroupDetails( @NonNull context: Context, @NonNull groupId: String, @Nullable detailsCallback: STWGroupDetailsCallback): AsyncTask
Content copied to clipboard
Load the group contact details asynchronously
Link copied to clipboard
open fun getGroupsOfContact(@NonNull context: Context, @NonNull contact: ContactItem): List<ContactItem>
Content copied to clipboard
Get the list of group contacts on witch the specified contact is member
open fun getGroupsOfContact( @NonNull context: Context, @NonNull contact: ContactItem, @Nullable loadContactsCallback: STWLoadContactsCallback): AsyncTask
Content copied to clipboard
Load asynchronously, the list of group contacts on witch the specified contact is member
Link copied to clipboard
Get or create the single instance of STWContactManager.
Link copied to clipboard
open fun getOperationalStatusByIdentifier(@NonNull context: Context, identifier: Int): OperationalStatusItem
Content copied to clipboard
Get operational status related to specified identifier
Link copied to clipboard
open fun getOperationalStatusList(@NonNull context: Context): List<OperationalStatusItem>
Content copied to clipboard
Get the operational status list
Link copied to clipboard
Link copied to clipboard
open fun getRoleIconByPhone(@NonNull context: Context, @NonNull phone: PhoneItem): RoleIconItem
Content copied to clipboard
Get the role icon for a specific PhoneItem
Link copied to clipboard
Get the role icon picture for the a specific roleIconId.
Link copied to clipboard
open fun getSingleContactByPhoneItem(@NonNull context: Context, @NonNull phoneItem: PhoneItem): ContactItem
Content copied to clipboard
Get the single ContactItem corresponding to the specified PhoneItem.
Link copied to clipboard
open fun getSmartMSContacts(@NonNull context: Context): List<ContactItem>
Content copied to clipboard
open fun getSmartMSContacts(@NonNull context: Context, @Nullable filtersList: STWContactFilterOption): List<ContactItem>
Content copied to clipboard
open fun getSmartMSContacts(@NonNull context: Context, @Nullable keyWord: String): List<ContactItem>
Content copied to clipboard
Get All contacts from other departments, other companies and other SmartMs Apps witch are synced with local contacts
open fun getSmartMSContacts(@NonNull context: Context, @Nullable loadCallback: STWLoadContactsCallback): AsyncTask
Content copied to clipboard
Async method to get All contacts from other departments, other companies and other SmartMs Apps witch are synced with local contacts This is async method
Link copied to clipboard
open fun getSmartMsPhoneByContactItem(@NonNull context: Context, @NonNull contactItem: ContactItem): PhoneItem
Content copied to clipboard
Get the first PhoneItem, belongs to SmartMS community, related to the specified contact
Link copied to clipboard
open fun getSubscriberConnectionStatus( @Nullable lifecycle: Lifecycle, @NonNull phoneNumber: String, @Nullable subscriberConnectionStatusCallback: STWSubscriberConnectionStatusCallback)
Content copied to clipboard
Load the contact connection status linked to Technical disconnect feature
Link copied to clipboard
open fun inviteGuest( @NonNull context: Context, @NonNull phoneNumber: String, @NonNull firstName: String, @NonNull lastName: String, @Nullable email: String, @Nullable details: String, @Nullable recipientPhonesList: List<PhoneItem>, @Nullable recipientContactList: List<ContactItem>, sendMethod: Int, @Nullable inviteGuestCallback: STWInviteGuestCallback)
Content copied to clipboard
Call this method to invite a Guest
Link copied to clipboard
open fun isDefaultFilterForALlUsersAllowed(@NonNull context: Context): Boolean
Content copied to clipboard
Whether the default filter for all users allowed or not
Link copied to clipboard
Check whether the IconPerRole feature is enabled.
Link copied to clipboard
open fun isPublicVisibilityChangeEnabled(@NonNull context: Context): Boolean
Content copied to clipboard
Call this method to check whether the Public visibility can be changed on user settings or not
Link copied to clipboard
Call this method to check if the Public Visibility is enabled or not
Link copied to clipboard
open fun isReverseContactNameDisplayEnabled(@NonNull context: Context): Boolean
Content copied to clipboard
Check if reverse contact name option is enabled.
Link copied to clipboard
open fun loadContactPicture( @NonNull context: Context, @Nullable lifecycle: Lifecycle, @NonNull imageView: ImageView, @NonNull contact: STWContact, @Nullable defaultContactIconResources: DefaultContactIconResources)
Content copied to clipboard
open fun loadContactPicture( @NonNull context: Context, @Nullable lifecycle: Lifecycle, @NonNull imageView: ImageView, @NonNull contact: ContactItem, @Nullable defaultContactIconResources: DefaultContactIconResources)
Content copied to clipboard
Try to load asynchronously the contact picture in the imageView.
Link copied to clipboard
Call this method to force updated of system contacts
Link copied to clipboard
open fun registerContactListUpdatesListener(@NonNull listener: STWContactUpdateListener)
Content copied to clipboard
Register the listener to be notified by all contacts changes like: -New Contact (Single or group) added -Contact removed from company -Local Contact was synced with company -Contact information updated
Link copied to clipboard
open fun registerPublicVisibilityListener(@NonNull listener: OnPublicVisibilityChangeListener)
Content copied to clipboard
Register to the event related to the update of the Public Visibility
Link copied to clipboard
open fun setUserPublicVisibility(publicVisibility: Boolean, @Nullable callback: STWContactSettingRequestCallback)
Content copied to clipboard
Call this method to change the user Public Visibility
Link copied to clipboard
Call this method to synchronize local contacts with server to get contacts that exist in the phone address book, and then contacts will be updated automatically every 10 minutes Note that : android.permission.
Link copied to clipboard
open fun unregisterContactListUpdatesListener(@NonNull listener: STWContactUpdateListener)
Content copied to clipboard
Unregister the listener to not be notified by all contacts changes anymore
Link copied to clipboard
open fun unregisterPublicVisibilityListener(@NonNull listener: OnPublicVisibilityChangeListener)
Content copied to clipboard
Unregister a previously registered Public Visibility listener