Setup
Get your Application Keys
Signup for CometChat and then:
- Create a new app
- Head over to the Credentials section and note the App ID, Auth Key & Region
Add the CometChatCalls Dependency
Install the package as NPM module:
- npm
- yarn
npm install @cometchat/calls-sdk-ionic
yarn add @cometchat/calls-sdk-ionic
Configuration
Android
Goto ./android
folder and open project-level build Gradle file and add all repository URLs in the repositories
block under the allprojects
section.
- build.gradle
allprojects {
repositories {
maven {
url "https://dl.cloudsmith.io/public/cometchat/cometchat-pro-android/maven/"
}
}
}
You also need to update the minimum SDK version to 24
. You can update the minSDKVersion in the variables.gradle
file located in the android
folder.
- variables.gradle
minSdkVersion = 24
iOS:
Please update the minimum target version in the Podfile. Goto ./ios/App folder and open the Podfile.
- Podfile
platform :ios, '12.0'
Open the ios/App
folder and run pod install
this will create an App.xcworkspace
open this and run the app.
Initialize CometChatCalls
The init()
method initialises the settings required for CometChatCalls
. The init()
method takes a single paramater, that is the instance of CallAppSettings
class.
The CallAppSettingsBuilder
class allows you to configure three settings:
- appID: You CometChat App ID
- region: The region where your app was created
- host: This method takes the client URL as input and uses this client URL instead of the default client URL. This can be used in case of dedicated deployment of CometChat.
You need to call init() before calling any other method from CometChatCalls
. We suggest you call the init() method on app startup, preferably in the index.js file.
- Javascript
- Typescript
import { CometChatCalls } from '@cometchat/calls-sdk-ionic';
let appID = "APP_ID";
let region = "REGION";
const callAppSetting = new CometChatCalls.CallAppSettingsBuilder()
.setAppId(appID)
.setRegion(region)
.build();
CometChatCalls.init(callAppSetting).then(
() => {
console.log("CometChatCalls initialization completed successfully");
},
(error) => {
console.log("CometChatCalls initialization failed with error:", error);
}
);
import { CometChatCalls } from '@cometchat/calls-sdk-ionic';
import { CallAppSettings } from '@cometchat/calls-sdk-ionic/dist/models/CallAppSettings';
let appID: string = "APP_ID";
let region: string = "REGION";
const callAppSetting: CallAppSettings = new CometChatCalls.CallAppSettingsBuilder()
.setAppId(appID)
.setRegion(region)
.build();
CometChatCalls.init(callAppSetting).then(
() => {
console.log("CometChatCalls initialization completed successfully");
},
(error) => {
console.log("CometChatCalls initialization failed with error:", error);
}
);
Make sure you replace the APP_ID
with your CometChat App ID and REGION
with your App Region in the above code.
Parameter | Description |
---|---|
callAppSettings | An object of the CallAppSettings class |