How to enable customers to call your agents directly from your Android application
The VideoEngager SDK for Android allows you to integrate chat, voice, and video calling into your native Android mobile applications. This way, you would enable your customers:
- to call your agents directly from your Android application through Click to Audio and/or Click to Video type of functionalities
- to initiate a chat session over Genesys chat channel
Image based on a design of a Banking App Concept by Vitaly Silkin via Sketch App Sources
Highlights
- Available for VideoEngager Standalone
- Supports Genesys Cloud
- To support Genesys Engage (estimated release date mid Jun 2021)
- Onmi-channel experience + click to chat, click to voice, click to video
- Localization (supports English (en_US), Spanish (es_ES), Portuguese (pt_PT), German (de_DE), and Bulgarian (bg_BG))
- Video on/off + Front/back camera rotation
- Mic on/off + multiple audio sources (automatic and manual selection)
- Secure File Transfer
- Torch control
Prerequisites
- Android Developer Studio 4.1 or higher
- Androidx.core:core-ktx:1.3.2 or higher
- Android 21 (Android 5.0 "Lollipop") or higher
Integration
The VideoEngager SDK can be integrated in three steps:
- Step 1: SDK Installation
- Step 2: SDK Initialization
- Step 3: Connect Native app buttons
Step 1 - SDK Installation
Installation of VideoEngager is currently performed by adding videoengager-sdk-release.aar
to libs
project's lib directory.
In addition, all the dependencies shall be added to the project, as follows:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
implementation 'com.google.code.gson:gson:2.8.6'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0"
implementation 'com.squareup.picasso:picasso:2.8'
implementation 'org.webrtc:google-webrtc:1.0.22270'
}
Step 2 - SDK Initialization for Genesys Cloud
The SDK initialization process is consisting of three sub-steps.
- Initialization Sub-Step 1: Configure SDK to use your Genesys Cloud Organization
assets/params.json
file shall be updated to provide the correct parameters of your organization.Name | Type | Value |
VideoEngager URL | String | videome.videoengager.com (unless you have a custom subdomain) |
Tenant Id |
String |
|
Agent Short Url |
String |
|
Environment | String | https://api.mypurecloud.com (or your preferred Genesys Cloud location) |
Queue Name | String | Here you need to provide the name of your GenesysCloud queue. This the queue that is setup to process VideoEngager interactions |
Organization ID | String | Your GenesysCloud organization Id |
Deployment ID | String | Your VideoEngager deployment Id |
2. Initialization Sub-Step 2: SDK configuration at run time
After installation and configuration is done, it is time to integrate the VideoEngager SDK within your own app. Easiest would be to use the demo app in this repository. If you want to do so, pls open with AndroidStudio SmartVideo-Android-SDK-Demo-App Project and Run it.
The VideoEngager SDK will expose the following functionalities to hosting Android/Kotlin/ app:
- place a voice call to VideoEngager standalone or Genesys Cloud queue
- place a video call to to VideoEngager standalone or Genesys Cloud queue
- send chat message to a Genesys Cloud agent over Genesys Cloud chat channel
- receive chat message from a Genesys Cloud agent over Genesys Cloud chat channel
By integrating VideoEngager.EventListener
, Android developers will get an expose to a few more methods that will be covered in section Error Handling.
All the remaining functionalities of the VideoEngager SDK remain under the control of the SDK and are not exposed to hosting Android app.
VideoEngager
InitializeThe initialization step requires to:
- import com.videoengager.sdk.VideoEngager
- Load settings from params.json
- initialize VideoEngager.class
This would require to add inside your Activity the following code snippets:
import com.videoengager.sdk.VideoEngager import com.videoengager.sdk.model.Settings import com.videoengager.sdk.tools.LangUtils import com.videoengager.sdk.model.Settings data class Params( val genesys_cloud_params_init:Settings, val generic_params_init:Settings, val genesys_engage_params_init:Settings ) //.... lateinit var params:Params; override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) //load params.json from assets folder using Gson lib val params = Gson().fromJson(assets.open("params.json").reader(Charsets.UTF_8),Params::class.java) //... }
3. Initialization Sub-Step 3: Add SDK delegates
Error Handling
This step requires to prepare your app for error handling.
Run time errors cover the usage of the SDK within the host app. When the host app starts a video or audio call, the SDK will initiate a series of REST calls and socket exchange, between the SDK, Genesys Cloud and VideoEngager data centres. If any error happens before the call is established, the SDK won't provide any UI for error handling and will only return error message through an optional method, named onErrorMessage(type:String,message:String)
. An error at this stage can be triggered, if wrong parameters are provided in assets/params.json
. Host app developers shall be responsible for handling errors at this stage. This demo app provides a simplified error handling, which can be reviewed by going to file GC_Activity.kt
and looking in the VideoEngager.EventListener method override fun onErrorMessage(type: String, message: String)
The other type of errors that this SDK handles is during already established call. For instance, if the host app internet gets down for some reason, the SDK will inform the mobile app user and shortly after that the call will be ended. The host app can implement an optional delegate method, if some other action is required to be processed, when this event is triggered. This event method is override fun onIsConnectedToInternet(isConnected:Boolean)
. Another example of error handling inside the SDK, are when agent's internet connectivity is down. In this case, the SDK will again inform the mobile app user and shortly after that the call will be also ended. The host app can implement an optional delegate method, if some other action is required to be processed, when this event is triggered. This delegate method is override fun onPeerConnectionLost()
.
Send chat message to Genesys Cloud Agent over Genesys Chat channel
To send chat message one needs to invoke the following method
val myAwesomeMessage = "Hola Agent!"
video?.SendMessage(myAwesomeMessage)
Receive chat message from Genesys Cloud Agent over Genesys Chat channel
To receive, one needs to add the following event listener:
val listener = object : VideoEngager.EventListener(){ override fun onMessageReceived(message: String) { //fires when agent send chat message }
}
Step 3 - Connect host app buttons to VideoEngager SDK
Here is an example about adding buttons for Click-to-Video and/or Click-to-Audio:
// ....
findViewById<Button>(R.id.button_audio).setOnClickListener { //allow more verbose debug Logcat messages VideoEngager.SDK_DEBUG=true //change some additional values like preferred Language params.genesys_cloud_params_init!!.Language=VideoEngager.Language.ENGLISH val video = VideoEngager(this, params.genesys_cloud_params_init!!, VideoEngager.Engine.genesys) if (video.Connect(VideoEngager.CallType.audio)) { //handle events with event listener video.onEventListener = listener } else Toast.makeText(this, "Error from connection", Toast.LENGTH_SHORT).show() } findViewById<Button>(R.id.button_video).setOnClickListener { //allow more verbose debug Logcat messages VideoEngager.SDK_DEBUG=true //change some additional values like preferred Language params.genesys_cloud_params_init!!.Language=VideoEngager.Language.ENGLISH val video = VideoEngager(this, params.genesys_cloud_params_init!!, VideoEngager.Engine.genesys) if (video.Connect(VideoEngager.CallType.video)) { //handle events with event listener video.onEventListener = listener } else Toast.makeText(this, "Error from connection", Toast.LENGTH_SHORT).show() }
Last Step - Finish and release your awesome app
Minimum Supported Version
minSdkVersion
for the Android SDK is 21 (Android 5.0 "Lollipop").
Demo App
We offer a demo app to help minimize onboarding time of app developers. The demo app contains detailed instructions in a README.md file.
We listen to our customers
We, the VideoEngager team, believe that addressing customer pains in timely manner is of utmost importance and key to success for all stakeholders. Our team is highly responsive to customer request. We would like to encourage you to share any suggestions for improvement of troubleshooting guide. To do so, please contact us by sending email to our support team.
Comments
0 comments
Please sign in to leave a comment.