Environment Setup

Steps to integrate CometChat plugin to your application.

The CometChat plugin supports Android (version 7 and higher) and iOS platform, which can be added to your project using the command:

cordova platform add android
cordova platform add ios

To install the CometChat plugin in your project use the following command in your terminal/ command prompt from your project directory :

cordova plugin add cordova-plugin-cccometchat

If you wish to add CometChat plugin into your Ionic project you can add the keyword ionic before Cordova as

ionic cordova plugin add cordova-plugin-cccometchat

Since the CometChat plugin in iOS makes use of Cocoapods there might be some chances of improper loading of pods into your project.In such case, you can run pod update command in a terminal from ios directory present under platforms of your project.

The above command will add the CometChat plugin into the project, once added you can move forward to Initialisation.

In case of Android, the CometChat plugin uses the below permissions.

    <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