STWContactManager

open class STWContactManager
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
  1. Retreive all contacts
    1. 
      STWContactManager.getInstance().getAllContacts(this, STWContactFilter.ALL, new STWContactManager.STWLoadContactsCallback() {
      
      public void onComplete(List<ContactItem> contactList)
      {
      // Update your RecyclerView/ListView
      }
      });
      
    2. 
      {
          @code
          ListcontactList = STWContactManager.getInstance().getAllContacts(context, STWContactFilter.ALL);
      }
  2. Retreive all company contacts
    1. 
      STWContactManager.getInstance().getCompanyContacts(this, STWContactFilter.ALL, new STWContactManager.STWLoadContactsCallback() {
      
      public void onComplete(List<ContactItem> contactList)
      {
      // Update RecyclerView
      }
      });
      
    2. 
      {
          @code
          ListcompanyContactList =
              STWContactManager.getInstance().getCompanyContacts(context, STWContactFilter.ALL);
      }
  3. Retreive all SmartMs contacts
    1. 
      STWContactManager.getInstance().getSmartMSContacts(this, new STWContactManager.STWLoadContactsCallback() {
      
      public void onComplete(List<ContactItem> list)
      {
      // Update RecyclerView
      }
      });
      
    2. 
      {
          @code
          ListsmartMSContactList = STWContactManager.getInstance().getSmartMSContacts(context);
      }
  4. Load contact pictures
    
    STWContactManager.getInstance().loadContactPicture(context, imageView, placeHolderBitmap);
    
  5. Find a contact by number
    
    {
        @code
        ContactItem contact = STWContactManager.getInstance().getContactByNumber(context, number);
    }
    
  6. Retreive single contact details
    
    STWContactManager.getInstance().getContactDetails(context, number, new STWContactManager.STWContactDetailsCallback(){
    
    
    public void onComplete(ContactItem contact)
    {
    // code
    }
    
    
    public void onFail()
    {
    // code
    }
    });
    
  7. Retreive group contact details
    
    STWContactManager.getInstance().getGroupDetails(context, groupId,  new STWContactManager.STWGroupDetailsCallback(){
    
    public void onComplete(List<ContactItem> contactList)
    {
    // code
    }
    
    
    public void onFail()
    {
    // code
    }
    });
    
  8. /Check if public visibility feature is enabled for current user
    
                 boolean isPublicVisibilityEnabled = STWAccountManager.getInstance().isPublicVisibilityEnabled(getContext());
             

Functions

Link copied to clipboard
open fun createSearchController(@NonNull callback: STWContactSearchCallback, window: Int): STWSearchController
Create an instance of STWSearchController
Link copied to clipboard
open fun enableReverseContactNameDisplay(@NonNull context: Context, enabled: Boolean)
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>
Get All contacts including visible company contacts and all SmartMs contacts
open fun getAllContacts(    @NonNull context: Context,     filter: Int,     @Nullable loadCallback: STWLoadContactsCallback): AsyncTask
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>
open fun getAllLocalContacts(@NonNull context: Context, @Nullable keyWord: String): List<ContactItem>
Get All local contacts (smartMs and system contacts)
Link copied to clipboard
open fun getAllowedOperationalStatusList(@NonNull context: Context): List<OperationalStatusItem>
Get the allowed operational status list for the subscriber.
Link copied to clipboard
open fun getBusinessPhone(@NonNull context: Context, @NonNull contactItem: ContactItem): PhoneItem
Get the business PhoneItem related to the specified contact.
Link copied to clipboard
open fun getCompanyContacts(@NonNull context: Context, @Nullable filter: STWContactFilterOption): List<ContactItem>
open fun getCompanyContacts(    @NonNull context: Context,     @Nullable filtersList: STWContactFilterOption,     @Nullable keyWord: String): List<ContactItem>

open fun getCompanyContacts(@NonNull context: Context, filter: Int): List<ContactItem>
Get only visible company contacts
open fun getCompanyContacts(    @NonNull context: Context,     filter: Int,     @Nullable loadCallback: STWLoadContactsCallback): AsyncTask
Async method to get only visible company contacts
open fun getCompanyContacts(    @NonNull context: Context,     filter: Int,     @Nullable keyWord: String): List<ContactItem>
Get only visible company contacts matching searchKeyWord
Link copied to clipboard
open fun getCompanyContactsForAllGroup(@NonNull context: Context): List<ContactItem>
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
Get, if exist, the ContactItem having the specified groupId
Link copied to clipboard
open fun getContactByGroupName(@NonNull context: Context, @NonNull groupName: String): ContactItem
Get the group contact having the specified groupName
Link copied to clipboard
open fun getContactById(@NonNull context: Context, @NonNull contactId: String): ContactItem
Get, if exist, the ContactItem having the specified Id
Link copied to clipboard
open fun getContactByNumber(@NonNull context: Context, @NonNull number: String): List<ContactItem>
Tries to find contacts by number
Link copied to clipboard
open fun getContactBySystemContactId(@NonNull context: Context, @Nullable sysContactId: String): ContactItem
get contactItem with systemContact
Link copied to clipboard
open fun getContactDetailCacheLifeTime(@NonNull context: Context): Long
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>
Load the contact details asynchronously
Link copied to clipboard
open fun getContactPhones(@NonNull context: Context, @NonNull contactItem: ContactItem): List<PhoneItem>
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>
Link copied to clipboard
open fun getContactPictureBitmap(    @NonNull context: Context,     @NonNull contact: STWContact,     @Nullable defaultContactIconResources: DefaultContactIconResources): Bitmap

open fun getContactPictureBitmap(    @NonNull context: Context,     @NonNull contact: ContactItem,     @Nullable defaultContactIconResources: DefaultContactIconResources): Bitmap
Get contact picture in the imageView.
Link copied to clipboard
open fun getDefaultFilterOperationalStatus(@NonNull context: Context): String
Get default Operational Status Filters
Link copied to clipboard
open fun getDisplayName(@NonNull context: Context, @NonNull phoneItem: PhoneItem): String
Get get Display name for phoneItem
Link copied to clipboard
open fun getDisplayNameForContactItem(@NonNull context: Context, @NonNull contactItem: ContactItem): String
Get get Display name for contact item
Link copied to clipboard
open fun getGroupDetails(    @NonNull context: Context,     @NonNull groupId: String,     @Nullable detailsCallback: STWGroupDetailsCallback): AsyncTask
Load the group contact details asynchronously
Link copied to clipboard
open fun getGroupsOfContact(@NonNull context: Context, @NonNull contact: ContactItem): List<ContactItem>
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
Load asynchronously, the list of group contacts on witch the specified contact is member
Link copied to clipboard
open fun getInstance(): STWContactManager
Get or create the single instance of STWContactManager.
Link copied to clipboard
open fun getOperationalStatusByIdentifier(@NonNull context: Context, identifier: Int): OperationalStatusItem
Get operational status related to specified identifier
Link copied to clipboard
open fun getOperationalStatusList(@NonNull context: Context): List<OperationalStatusItem>
Get the operational status list
Link copied to clipboard
open fun getPhoneByNumber(@NonNull context: Context, @Nullable phoneNumber: String): PhoneItem
Get, if exist, the PhoneItem corresponding to the specified internationalNumber
Link copied to clipboard
open fun getRoleIconByPhone(@NonNull context: Context, @NonNull phone: PhoneItem): RoleIconItem
Get the role icon for a specific PhoneItem
Link copied to clipboard
open fun getRoleIconPicture(roleIconId: Int): Bitmap
Get the role icon picture for the a specific roleIconId.
Link copied to clipboard
open fun getSingleContactByPhoneItem(@NonNull context: Context, @NonNull phoneItem: PhoneItem): ContactItem
Get the single ContactItem corresponding to the specified PhoneItem.
Link copied to clipboard
open fun getSmartMSContacts(@NonNull context: Context): List<ContactItem>
open fun getSmartMSContacts(@NonNull context: Context, @Nullable filtersList: STWContactFilterOption): List<ContactItem>
open fun getSmartMSContacts(@NonNull context: Context, @Nullable keyWord: String): List<ContactItem>
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
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
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)
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)
Call this method to invite a Guest
Link copied to clipboard
open fun isDefaultFilterForALlUsersAllowed(@NonNull context: Context): Boolean
Whether the default filter for all users allowed or not
Link copied to clipboard
open fun isIconPerRoleFeatureAllowed(@NonNull context: Context): Boolean
Check whether the IconPerRole feature is enabled.
Link copied to clipboard
open fun isPublicVisibilityChangeEnabled(@NonNull context: Context): Boolean
Call this method to check whether the Public visibility can be changed on user settings or not
Link copied to clipboard
open fun isPublicVisibilityEnabled(@NonNull context: Context): Boolean
Call this method to check if the Public Visibility is enabled or not
Link copied to clipboard
open fun isReverseContactNameDisplayEnabled(@NonNull context: Context): Boolean
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)

open fun loadContactPicture(    @NonNull context: Context,     @Nullable lifecycle: Lifecycle,     @NonNull imageView: ImageView,     @NonNull contact: ContactItem,     @Nullable defaultContactIconResources: DefaultContactIconResources)
Try to load asynchronously the contact picture in the imageView.
Link copied to clipboard
open fun refreshSystemContacts()
Call this method to force updated of system contacts
Link copied to clipboard
open fun registerContactListUpdatesListener(@NonNull listener: STWContactUpdateListener)
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)
Register to the event related to the update of the Public Visibility
Link copied to clipboard
open fun setUserPublicVisibility(publicVisibility: Boolean, @Nullable callback: STWContactSettingRequestCallback)
Call this method to change the user Public Visibility
Link copied to clipboard
open fun syncSystemContacts()
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)
Unregister the listener to not be notified by all contacts changes anymore
Link copied to clipboard
open fun unregisterPublicVisibilityListener(@NonNull listener: OnPublicVisibilityChangeListener)
Unregister a previously registered Public Visibility listener