Skip to main content

Installation

DEPRECATION NOTICE

Our Cordova plugin for integrating our SDK is now deprecated. We highly recommend transitioning to our SDK using Swift Package Manager (SPM) for iOS and Gradle for Android. Please implement a custom wrapper to interface directly with the SDK methods.

For Ionic users, you can transition to using Capacitor, which supports working with native libraries seamlessly. This change will ensure better performance and more direct access to the latest SDK features.

Project Info

Cordova:

Terminal
cordova platform ls
  • Cordova CLI : 11.0.0

  • Cordova Android : android 10.1.2

  • Cordova iOS : ios 6.2.0

Integration Example#

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

Prerequisites#

Get started building by installing Cordova

  • Node
  • NPM
  • Cordova CLI

To verify the installation, open a new terminal window and run:

Terminal
node --version
npm --version

Install the Cordova CLI with npm:

Terminal
npm install -g cordova

Add the SDK to your project#

Add Cordova plugin

Terminal
cordova plugin add https://github.com/MeetingLawyers/cordova-plugin-meetinglawyers

Android#

Gradle Modification#

If your project contains the android platform, you need to add some modifications of your plugin.gradle in cordova-plugin-meetinglawyers/src/android/plugin.gradle

You have to send us an email to support@meetinglawyers.com to request the android sdk access credentials and add them to the configuration file as follows: username password

plugin.gradle
repositories {
google()
jcenter()
maven {
url = "https://maven.pkg.github.com/MeetingLawyers/android-sdk-chat/"
credentials {
// ask credentials to support@meetinglawyers.com
username = ""
password = ""
}
}
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
dependencies {
implementation 'com.meetinglawyers:sdk:1.1.58'
implementation platform('com.google.firebase:firebase-bom:29.0.0')
implementation 'com.google.firebase:firebase-core'
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-inappmessaging-display-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-dynamic-links-ktx'
implementation 'com.google.firebase:firebase-config-ktx'
implementation 'com.google.firebase:firebase-iid'
}

iOS#

Podfile Modification#

If your project contains the ios platform, you need to add the following code at the bottom of the Podfile. And run pod install again on {{YOUR_PROJECT}}/platforms/ios/.

Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if target.name == 'MessageKit'
config.build_settings['SWIFT_VERSION'] = '4.2'
end
config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf' # avoid too many symbols
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = "YES"
end
end
end

It should be something like this:

Podfile
# DO NOT MODIFY -- auto-generated by Apache Cordova
source 'https://cdn.cocoapods.org/'
source 'https://bitbucket.org/meetinglawyers/ios-cocoapods-specs.git'
source 'https://github.com/MeetingLawyers/ios-meeting-podspec.git'
platform :ios, '13.0'
use_frameworks!
target 'TestApp' do
project 'TestApp.xcodeproj'
pod 'MeetingLawyers', '0.2.7'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if target.name == 'MessageKit'
config.build_settings['SWIFT_VERSION'] = '4.2'
end
config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf' # avoid too many symbols
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = "YES"
end
end
end

Install Cocoapods dependencies in your iOS project {{YOUR_PROJECT}}/platforms/ios/:

Terminal
pod install
caution

On mac silicon computers you have to add a configuration to the CordovaLib project. After installing the dependencies open your .xcworkspace with Xcode and click on the CordovaLib project. Go to the Build Settings tab and search for the property Excluded Architectures. Add the following values:

Terminal
//:configuration = Debug
EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64
//:configuration = Release
EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64
//:completeSettings = some
EXCLUDED_ARCHS

Access permissions#

Access to camera or photo gallery always requires explicit permission from the user.

Your app must provide an explanation for its use of capture devices using the NSCameraUsageDescription and NSPhotoLibraryUsageDescription Info.plist key. iOS displays this explanation when initially asking the user for permission to attach an element in the current conversation. See: Apple Documentation

caution

Attempting to attach a gallery photo or start a camera session without an usage description will raise an exception.

Access to camera and microphone to request a Videocall.

Your app must provide an explanation for its use of capture devices using the NSCameraUsageDescription and NSMicrophoneUsageDescription Info.plist key. iOS displays this explanation when initially asking the user for permission to request a VideoCall.

Usage#

Initialize#

As soon as we receive a notification from the system telling that our application is already active, we must configure the framework by providing the client's API key configuration. You can call initialize method on deviceready event:

document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
// Cordova is now initialized. Have fun!
console.log('Running cordova-' + cordova.platformId + '@' + cordova.version);
document.getElementById('deviceready').classList.add('ready');
meetinglawyers.initialize(
{{API_KEY}}}, // Ex: '123456'
{{ENVIRONMENT}}, // Ex: 'DEVELOPMENT' | 'PRODUCTION'
function() {
// INIT OK: Start customization
},
function(err) {
// INIT ERROR
}
);
}

Next steps#