CometChat Developer Documentation

Welcome Ninja!

You'll find comprehensive guides and documentation to help you start working with CometChat as quickly as possible. Let's jump right in!

Get Started    

To add CometChat to your Xamarin.Forms app, please perform the following.

Add the NuGet packages for Android and iOS platforms to your project

The first step is to add the NuGet packages for both Android and iOS.

For Android:
a. Expand the Android project.
b. Right-click on the packages folder and click on Add packages.
c. Search for Xamarin.Android.CometChat package and add it to your project.
d. Search for Xamarin.Android.CometChat.UI package and add it to your project.

For iOS:
a. Expand the iOS project.
b. Right-click on the packages folder and click on Add packages.
c. Search for Xamarin.iOS.CometChat package and add it to your project.
d. Search for Xamarin.iOS.CometChat.UI package and add it to your project.
e. Open your project settings and go to Build tab, then select iOS Build option.
f. Type --registrar:static in Additional mtouch arguments textbox for release and debug configuration
of iPhoneSimulator and iPhone platform.
g. Click on Ok.

Add the helper classes to your main project

Add the implementation classes to the respective projects

Initialize the SDK

Initialization binds the SDK to your app and syncs the various basic parameters required for the CometChat SDK to function.

String licenseKey = "COMETCHAT-XXXXX-XXXXX-XXXXX-XXXXX";
String apiKey = "xxxxxxxxxxxxxxxxxxxxxx"; 

 var cometchat = DependencyService.Get<CometChatInterface>();

cometchat.initializeCometChat("", licenseKey, apiKey, true, new Callbacks(success => initializeSuccess(success), fail => initializeFail(fail)));

Important

The initializeCometChat() must only be called once in the entire scope of the app. We suggest you call the initializeCometChat() method on app startup.

Please Note

If you are using iOS platform, please add the below five privacy permissions in the info.plist file which are necessary to access all the features. Please refer the image below.