Environment Setup


Before you start with the integration of CometChat into your existing applications, kindly download the Xamarin SDK package from your client area which is my.cometchat.com or secure.cometchat.com.

The package consists of three folders:

a. CometChat – This folder consists of the cometchatbindingapp.dll/ MessageSDKFramework.dll file for Android/ iOS respectively.
b. CometChatUI – This folder consists of the CometChatUIBinding.dll/ CometChatUI.dll file for Android/ iOS respectively.
c. CometChat UI Binding – This folder consists of an project that we have created using our SDK. You can use the source code to make the necessary modifications to the app. Generate a new respective dll and import it in your project.

Steps to add CometChat to your application.

1. Add the respective dll files to your project as references. To add the references to your Xamarin studio project, please follow the below steps.

a. Right Click on References and select Edit References.
b. Go to .NET Assembly Tab.
c. Browse to the location where you have stored the dll files and add the respective files.

2. Add the following packages to your app using NuGet Manager.
For Android,
a. Xamarin.Android.Support.v4;
b. Xamarin.Android.Support.v7.AppCompat;
c. Xamarin.Android.Support.Design;
d. Xamarin.Android.Support.Core.UI;
e. Xamarin.Android.Support.Core.Utils;
f. Glide.Xamarin;
g. Ikomobi.MaterialishProgress;
h. Xamarin.Firebase.Core
i. Xamarin.Firebase.Auth
j. Xamarin.Firebase.Database
k. Xamarin.Firebase.Messaging

3. You need to enable the Multidex for your android application. Right-Click on the project and select Options.Move to Android build and enable the Multi-Dex option available under Packaging and Deployment in General Tab.

4. In Android, next step is to add the necessary permissions to the AndroidMainfest.xml. Please add the below-mentioned permissions to your application’s AndroidManifest.xml file.

<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.SEND_SMS" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.USE_CREDENTIALS" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" />

Please Note: For devices running Android 6.0 (API level 23) or above, users need to grant the permission to the app when the app is running and not before installing the app. This needs to be handled by you within the app else it may result in the application crashing. For more information regarding the dynamic permissions in android, please visit the following link

  • Was this helpful?
  • Yes   No