Initialization

This section provides instructions on how to build the ConpeekClient instance required to interact with the Conpeek application. The ConpeekClient is configured with necessary URLs, UUIDs, available media types, device IDs, and event listeners.

Main rules and information

  1. Creating a ConpeekClient object initiates the connection by setting up the WebSocket to the API.
  2. For optimization, instantiate the ConpeekClient object only when necessary, such as in the "Contact" tab.
  3. If the ConpeekClient object is no longer needed, close it using the close() function.
  4. WebSocket reconnection occurs automatically.
  5. HTTP requests are performed asynchronously, with success or failure responses transmitted via callbacks in the * ClientEventListener*.
  6. The application uses a FixedThreadPool with 3 threads and a ScheduledThreadPool with 4 threads. A maximum of 3 WebSockets are created, each utilizing 2 threads.

How to generate SDK UUID and obtain TenantPluginAPIURL and ConfigurationID

To obtain the necessary TenantPluginAPIURL and generate the SdkUUID, follow these steps:

  • Open the Conpeek application and go to tenant settings.
  • Select the Services option.
  • Navigate to the Mobile SDK settings view, located below the Plugin JS settings.
  • In this view, you will find a field to generate the SdkUUID and a section to obtain the TenantPluginAPIURL.

Mobile SDK

To obtain the ConfigurationID, follow these steps: - In the top navigation bar, go to the Configuration Mobile SDK Configuration tab. - If you do not have any existing configurations, create a new one. - Copy the ConfigurationID from the list of available configurations.

Mobile SDK Configurations

Example

Step 1: Declare available media based on existing permissions

// Create the available media list
ArrayList<String> availableMedia = new ArrayList<>();
availableMedia.add(ConpeekClient.CHANNEL_CHAT); // Add chat channel by default

// Check and add audio channel if permission is granted
if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED) {
    availableMedia.add(ConpeekClient.CHANNEL_AUDIO); // Add audio channel if permission granted
}

// Check and add video channel if permission is granted
if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
    availableMedia.add(ConpeekClient.CHANNEL_VIDEO); // Add video channel if permission granted
}

Step 2: Build the ConpeekClient

// Build the ConpeekClient
ConpeekClient client = ConpeekClient.builder()
        .setTenantPluginAPIURL("https://tenantpluginapiserver1.example.conpeek.com") // Sets the URL of the tenant plugin API (provided in Conpeek Application)
        .setSdkUUID("f7kca40c-aml4-8182-b9cd-6054970e614e") // Sets the UUID of the SDK (provided in Conpeek Application)
        .setConfigurationID("665447a51594470a6f7725bc") // Sets the configuration ID (provided in Conpeek Application)
        .setAvailableMedia(availableMedia) // Sets the list of available media types
        .setDeviceID(UUID.randomUUID().toString()) // Sets the device ID (for verification purposes)
        .setEventListener(myClientEventListener) // Sets the event listener which will handle events
        .build();
  • setTenantPluginAPIURL: Sets the URL of the tenant plugin API (provided in Conpeek Application).
  • setSdkUUID: Sets the UUID of the SDK (provided in Conpeek Application).
  • setConfigurationID: Sets the configuration ID (provided in Conpeek Application).
  • setAvailableMedia: Sets the list of available media types. Possible values:
    • ConpeekClient.CHANNEL_CHAT: Enables chat functionality.
    • ConpeekClient.CHANNEL_AUDIO: Enables audio functionality (requires RECORD_AUDIO permission).
    • ConpeekClient.CHANNEL_VIDEO: Enables video functionality (requires CAMERA permission).
  • setDeviceID: Sets the device ID (for verification purposes).
  • setEventListener: Sets the event listener to handle events. This should be an instance of a class that implements the ClientEventListener interface.

By following these steps, you ensure that your Conpeek client is configured correctly and ready to interact with the system, including checking the actual project state and making the calls.

Proceed to the next step: Make call