Sample-chat-cordova

Ask tech team
From QuickBlox Developers (API docs, code samples, SDK)
Jump to: navigation, search

Contents

Deprecation notice

Deprecation notice

This documentation is outdated, the newest version of the documentation is now maintained at https://docs.quickblox.com/.

Sources

Project homepage on GIT:

Clone source code via Terminal (the way we recommend):

git clone https://github.com/QuickBlox/quickblox-javascript-sdk.git

or download ZIP:

Overview

Apache Cordova (PhoneGap) chat code sample that shows how to work with QuickBlox Chat API through JavaScript SDK.
It allows to integrate 1:1 and group chats into your Cordova application.

Platforms support

Browser iOS Android
+ + +

We didn't check it on other Cordova environments, feel free to do it.

Documentation

Integration details

Steps to build this code sample from scratch:

1. Create Cordova app:

cordova create HelloTextChat

2. Copy content from samples/chat to www folder of your Cordova app.

3. Add platforms:

cordova platform add ios --save
cordova platform add android --save
cordova platform add browser --save

4. Install WebSocket-for-Android plugin to support WebSockets on Android < 4.4

5. Install cordova-plugin-device

6. Install cordova-custom-config and add the following lines into config.xml (for iOS 10 to support files attachments in chat):

<platform name="ios">
  ...
  <config-file platform="ios" target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
    <string>Use camera for video calling</string>
  </config-file>
  <config-file platform="ios" target="*-Info.plist" parent="NSCameraUsageDescription">
    <string>Use microphone for video calling</string>
  </config-file>
</platform>

7. Install iOS Deployment Tools to launch iOS apps into an iOS Device.

9. (Important!) Customise index.html file and connect QuickBlox JS framework using 'https' path.

10. To run on device use the following commands:

cordova clean ios && cordova run ios --device
 
cordova clean browser && cordova run browser --device
 
cordova clean android && cordova run android --device


Debugging

The following tools will help you debug your Cordova application:

1. Safari Web inspector

2. cordova-plugin-console