Skip to main content

Installation

info

This integration replaces the discontinued Cordova plugin. If you were using it, migrate to this Capacitor-based approach.

Integration Example​

You have a repository available on GitHub with a sample project which contains a working Ionic + Capacitor app integrating the MeetingLawyers iOS and Android SDKs.

For MeetingPros apps (lawyers together with doctors and vets), see MeetingPros below.

How it works​

Capacitor apps integrate the native SDKs through a small local Capacitor plugin that you copy into your own project. No npm package is needed. The native code is the same MeetingLawyersIntegration file used by the iOS and Android samples, and the plugin only translates the calls. The rest of your app has no dependency on the SDK:

FileRole
src/plugins/meeting-lawyers/TypeScript API (definitions.ts and index.ts): configure, configureTheme, authenticate, openProfessionalList, openChat, isAuthenticated, logout
ios/App/App/MeetingLawyersPlugin.swiftiOS plugin
ios/App/App/MeetingLawyersIntegration.swiftiOS file that owns the SDK
ios/App/App/MyViewController.swiftBridge view controller: registers the plugin and hides the navigation bar over the web view
android/.../MeetingLawyersPlugin.ktAndroid plugin
android/.../MeetingLawyersIntegration.ktAndroid file that owns the SDK
android/.../MeetingLawyersMessagingService.ktRoutes FCM messages and tokens to the SDK, configuring it from the saved values when a push wakes the app

Requirements​

CapacitorNodeiOSAndroidSDKs
8+22+Xcode 26+, iOS 15+Android Studio, JDK 21, minSdk 24MeetingLawyers iOS 2.2.1 and Android 2.1.16

Ask support@meetinglawyers.com for your SDK API_KEY.

Step 1: Copy the plugin​

Copy the files in the table above into the same paths of your Capacitor project. In the Android files, change the package line to your app's package.

Step 2: iOS setup​

  1. Open ios/App/App.xcodeproj and add these Swift Packages (Project > Package Dependencies > +) to the App target:
PackageVersionProduct
https://github.com/MeetingLawyers/ios-sdk-spm-meetinglawyersExact 2.2.1MeetingLawyers
https://github.com/firebase/firebase-ios-sdkExact 12.15.0FirebaseMessaging
  1. Embed the bridge view controller in a navigation controller, so the SDK screens are pushed over the web view. In Main.storyboard, set the bridge view controller's class to MyViewController, then choose Editor > Embed In > Navigation Controller. See the sample's Main.storyboard.

  2. Configure Firebase and start push handling in AppDelegate.swift:

ios/App/App/AppDelegate.swift
import Capacitor
import FirebaseCore
import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
MeetingLawyersIntegration.shared.startHandlingPushNotifications()
return true
}

// Keep Capacitor's URL and universal link handling from the template
func application(_ app: UIApplication, open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
return ApplicationDelegateProxy.shared.application(app, open: url, options: options)
}

func application(_ application: UIApplication, continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
return ApplicationDelegateProxy.shared.application(application, continue: userActivity,
restorationHandler: restorationHandler)
}
}
  1. Add your GoogleService-Info.plist to the App target, and the Push Notifications and Background Modes > Remote notifications capabilities.
  2. Add the camera and microphone usage descriptions to Info.plist, see the iOS access permissions table.

Step 3: Android setup​

  1. Add the Kotlin and Firebase Gradle plugins and the MeetingLawyers Maven repository to android/build.gradle. The repository is public, no credentials needed:
android/build.gradle
buildscript {
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.21'
classpath 'com.google.gms:google-services:4.4.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
}
}

allprojects {
repositories {
google()
mavenCentral()
maven {
url "https://sdk-download.meetinglawyers.com/android/maven/"
content { includeGroup "com.meetinglawyers" }
}
}
}
  1. Apply the plugins and add the dependencies in android/app/build.gradle. The SDK pulls in Firebase Crashlytics, so its plugin is required or the app crashes on launch with "The Crashlytics build ID is missing":
android/app/build.gradle
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

android {
kotlinOptions {
jvmTarget = '21'
}
}

dependencies {
implementation "com.meetinglawyers:sdk:2.1.16"
implementation platform("com.google.firebase:firebase-bom:32.7.1")
implementation "com.google.firebase:firebase-messaging"
}
  1. Register the plugin in MainActivity:
android/app/src/main/java/.../MainActivity.java
public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
registerPlugin(MeetingLawyersPlugin.class);
super.onCreate(savedInstanceState);
}
}
  1. Declare the messaging service inside <application> in AndroidManifest.xml and add your google-services.json to android/app/:
android/app/src/main/AndroidManifest.xml
<service android:name=".MeetingLawyersMessagingService" android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
  1. Keep the SDK session on the device: set android:allowBackup="false" on <application> and point android:dataExtractionRules to rules that exclude everything, like the sample's data_extraction_rules.xml.

Step 4: Use it from TypeScript​

import { MeetingLawyers } from './plugins/meeting-lawyers';

await MeetingLawyers.configure({ apiKey, environment: 'DEV' });
await MeetingLawyers.configureTheme({ primaryColor: '#1E5AA8' });
await MeetingLawyers.authenticate({ userId });
await MeetingLawyers.openProfessionalList();
await MeetingLawyers.openChat({ professionalHash });
await MeetingLawyers.logout();
MethodWhat it does
configureConfigures the SDK. environment: 'DEV' uses the demo environment, the default is 'PROD'. Call it once at startup
configureThemeApplies your colors to the SDK screens, see Theme colors
authenticateSigns the user in, asks for push permission and registers the push token
isAuthenticatedResolves { authenticated }, true while a user is signed in
openProfessionalListOpens the professional list. Tapping a professional opens its chat
openChatOpens the chat with a professional by professional hash
logoutSigns the user out

Errors from the native side reject the promise with a readable message.

userId is the user identifier provided by your backend integration, see the Public API - User documentation.

Theme colors​

Every color is optional and is a #RRGGBB or #RRGGBBAA string. The ones you leave out keep the SDK default:

OptionWhere
primaryColorMain tint of the SDK screens
secondaryColorAccents such as the professional speciality and the unread badge
navigationBarColorNavigation bar
incomingMessageColorChat bubbles of the professional
outgoingMessageColorChat bubbles of the user

For colors only one platform has, see iOS Customization and Android Customization, and call them from the MeetingLawyersIntegration file.

Step 5: Push notifications​

Push works over Firebase Cloud Messaging on both platforms. The code is already in the plugin: authenticate registers the push token, token refreshes are forwarded and MeetingLawyers pushes go to the SDK. To handle your own pushes too, see If your app already handles push. What is left is the Firebase setup:

  1. Create (or open) your project in the Firebase Console and register your iOS and Android apps. Their config files are the GoogleService-Info.plist and google-services.json of steps 2 and 3.
  2. iOS: in Project settings > Cloud Messaging, upload your APNs Authentication Key (.p8) with its Key ID and your Team ID. Without it, no push reaches iOS.
  3. In Project settings > Service accounts, click Generate new private key and send the JSON file to support@meetinglawyers.com. Treat it as a credential: keep it out of source control and send it securely.
note

Push is not available on every iOS simulator: it needs an Apple Silicon Mac with a recent macOS and Xcode. Otherwise, test it on a device.

If your app already handles push​

Only one object receives the push callbacks on each platform, so if your app (or another plugin) already handles push, forward the MeetingLawyers calls from it instead:

  • iOS: do not call startHandlingPushNotifications(). From your own UNUserNotificationCenterDelegate and MessagingDelegate, call the same methods of MeetingLawyersIntegration.shared (userNotificationCenter willPresent / didReceive and messaging(_:didReceiveRegistrationToken:)). They pass MeetingLawyers pushes to the SDK and complete any other push the usual way.
  • Android: do not declare MeetingLawyersMessagingService. From your own FirebaseMessagingService:
override fun onMessageReceived(remoteMessage: RemoteMessage) {
super.onMessageReceived(remoteMessage)
MeetingLawyersPlugin.configureFromSavedArguments(application)
if (!MeetingLawyersIntegration.onMessageReceived(remoteMessage.data)) {
// Not a MeetingLawyers push: handle it as usual
}
}

override fun onNewToken(token: String) {
super.onNewToken(token)
MeetingLawyersPlugin.configureFromSavedArguments(application)
MeetingLawyersIntegration.onNewToken(token)
}

MeetingPros​

MeetingPros apps offer lawyers (MeetingLawyers SDK) together with doctors and vets (MeetingDoctors SDK). The MeetingPros Capacitor sample follows the same steps with a MeetingPros plugin over the MeetingProsIntegration files. See MeetingPros for what the integration does. Ask support@meetinglawyers.com for a MeetingLawyers API key and a MeetingDoctors API key.

Files to copy:

FileRole
src/plugins/meeting-pros/TypeScript API (definitions.ts and index.ts): configure, configureTheme, authenticate, openProfessionalList, openLawyerChat, availableFeatures, openFeature, isAuthenticated, logout
ios/App/App/MeetingProsPlugin.swiftiOS plugin
ios/App/App/MeetingProsIntegration.swiftiOS file that owns both SDKs
android/.../MeetingProsPlugin.ktAndroid plugin
android/.../MeetingProsIntegration.ktAndroid file that owns both SDKs
android/.../MeetingProsMessagingService.ktRoutes FCM messages and tokens to both SDKs

What changes from the steps above:

  • iOS: also add https://github.com/Meeting-Doctors/meetingdoctors-sdk-spm (exact 11.6.3, product MeetingDoctorsSDKWrapper). In AppDelegate.swift use MeetingProsIntegration, and register MeetingProsPlugin in MyViewController.
  • Android: also add the MeetingDoctors repository and dependencies, register MeetingProsPlugin in MainActivity and declare .MeetingProsMessagingService in the manifest. The app theme must descend from Theme.MaterialComponents, and remove the template's androidx.core.content.FileProvider from the manifest because MeetingDoctors declares its own:
android/build.gradle
maven { url "https://storage.googleapis.com/production-mobile-sdks/android/" }
android/app/build.gradle
dependencies {
implementation "com.meetingdoctors:customer-chat-sdk:2.9.0"
implementation "com.meetingdoctors:videocall-sdk:3.0.22"
implementation "com.meetingdoctors:meetingdoctors-security-sdk:1.1.0"
}

Use it from TypeScript:

import { MeetingPros } from './plugins/meeting-pros';

await MeetingPros.configure({ lawyersApiKey, doctorsApiKey, environment: 'DEV' });
await MeetingPros.configureTheme({ primaryColor: '#2E7D6B' });
await MeetingPros.authenticate({ userId });
await MeetingPros.openProfessionalList({ type: 'lawyers' });
await MeetingPros.openLawyerChat({ professionalHash });
const { features } = await MeetingPros.availableFeatures();
await MeetingPros.openFeature({ feature: 'medicalHistory' });
await MeetingPros.logout();
MethodWhat it does
configureConfigures both SDKs. environment: 'DEV' uses the MeetingLawyers demo environment and the MeetingDoctors staging one
configureThemeApplies your brand color (primaryColor) to both SDKs
authenticateSigns the user into both SDKs, asks for push permission and registers the push token
isAuthenticatedResolves { authenticated }, true only while the user is signed into both SDKs
openProfessionalListOpens the lawyers, doctors or vets list
openLawyerChatOpens the chat with a lawyer by professional hash
availableFeaturesThe MeetingDoctors features your company has: videoCall, medicalHistory, myHealth, booking, appointments. Call it after authenticate
openFeatureOpens one of those features. Fails when the company does not have it
logoutSigns the user out of both SDKs