Skip to main content

Installation

Integration Example#

You have a repository available on Github with a sample project which contains an example of how to integrate our SDK.

Requirements#

JavaFirebaseMeetingLawyers SDKandroidStatus
17+32.7.1+2.1.323+ (Android 6.0)Supported

Configuration#

Edit your build.gradle project level:

You need to send us an email to support@meetinglawyers.com to request the android sdk access credentials, and SDK API_KEY.

Add MeetingLawyers maven repositories to settings.gradle file:

allprojects {
repositories {
google()
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/MeetingLawyers/android-sdk-chat/")
credentials {
// ask credentials to support@meetinglawyers.com
username = ""
password = ""
}
}
}
}

Edit your build.gradle app level:

Include MeetingLawyers SDK lib as a dependency

implementation 'com.meetinglawyers:sdk:SDK_VERSION'

Make sure the app's build.gradle file contains the following code snippet within android section

buildFeatures.compose = true
composeOptions {
kotlinCompilerExtensionVersion = "1.5.15"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}

Initialization#

Edit or add an application class:

The library must be initialized inside Application.onCreate() using your API_KEY, provided by MeetingLawyers.
You can switch between environments by setting the targetEnvironment parameter to CustomerSdkBuildMode.PROD or CustomerSdkBuildMode.DEV.

class App : Application() {
override fun onCreate() {
super.onCreate()
MeetingLawyersSDK(
this,
API_KEY,
CustomerSdkBuildMode.PROD,
locale
).build()
}
}

The build() method returns an instance of MeetingLawyersClient. You can then add this instance to your dependency injection container or setup. This allows the instance to be properly managed throughout the application's lifecycle, improving code maintainability, testing, and scalability.

Customization with Builder Pattern#

The SDK allows UI customization using a builder pattern. You can configure various interface colors before calling build().

Example Customization#

MeetingLawyersSDK(
context = this,
apiKey = API_KEY,
targetEnvironment = CustomerSdkBuildMode.PROD,
locale = locale
)
.primaryColor(Color.RED)
.secondaryColor(Color.BLUE)
.professionalSpecialityTextColor(Color.GRAY)
.unreadMessagesBadgeBgColor(Color.YELLOW)
.professionalDescriptionColor(Color.BLACK)
.disabledProfessionalColor(Color.DKGRAY)
.ongoingMessageBgColor(Color.GREEN)
.incomingMessageBgColor(Color.CYAN)
.build()

Available Customizations#

  • primaryColor(color: Int?)
    Sets the primary interface color.

  • secondaryColor(color: Int?)
    Sets the secondary interface color.

  • professionalSpecialityTextColor(color: Int?)
    Sets the text color for professional specialties.

  • unreadMessagesBadgeBgColor(color: Int?)
    Sets the background color for the unread messages badge.

  • professionalDescriptionColor(color: Int?)
    Sets the text color for professional descriptions.

  • disabledProfessionalColor(color: Int?)
    Sets the color for disabled professionals.

  • ongoingMessageBgColor(color: Int?)
    Sets the background color for outgoing messages.

  • incomingMessageBgColor(color: Int?)
    Sets the background color for incoming messages.

Authentication#

To authenticate a patient, provide a valid userId previously created with the S2S User API. Make sure not to use any other library method before you receive a successful response in the listener.

MeetingLawyersSDK.getClientInstance().authenticate("userId", object : SDKCallbackWithoutData {
override fun onSuccess() {
/* Your code here */
}
override fun onError(message: String?) {
/* Your code here */
}
})

Push notifications handling#

In order to enable push notifications for chat and video call you must provide MeetingLawyers valid credentials (Server Key and Sender Id) from Firebase Console inside Project settings/Cloud Messaging section:

After that, you can proceed to register your push tokens in the SDK:

class ExampleMessagingService : FirebaseMessagingService() {
override fun onMessageReceived(remoteMessage: RemoteMessage) {
super.onMessageReceived(remoteMessage)
/* Your code to process remoteMessage */
/* Redirect remoteMessage to SDK */
val data = remoteMessage.data["data"]
if (data != null) {
MeetingLawyersSDK.getClientInstance().onPushMessageReceived(data)
}
}
override fun onNewToken(newToken: String) {
super.onNewToken(newToken)
/* Register new push token */
MeetingLawyersSDK.getClientInstance().onNewTokenReceived(newToken)
}
}

The SDK will only process its own messages so you can send it all incoming pushes if you can't filter them properly.