Add voice/video calling, texting, and rich media messaging into any mobile or web application.
Get Bit6 sample app running in 10 minutes - follow our Quick Start guides for:
- Get the API Key at Bit6 Dashboard.
$ cordova plugin add https://github.com/bit6/bit6-cordova
Initialize Bit6 Plugin with your API key.
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
var opts = {'apikey': 'yourApiKey'};
var b6 = Bit6.init(opts);
// Bit6 SDK has been initialized
}
To enable call support on iOS add iosrtc plugin
cordova plugin add cordova-plugin-iosrtc
Note: Check the plugin requirements on this page and building page
Note: no need to add iosrtc if your app does not use audio/video calls.
To enable call support on Android < 5 add Crosswalk Webview plugin
cordova plugin add cordova-plugin-crosswalk-webview
For real time notifications (websocket) on Android<4.4 Crosswalk Webview is required.
For call support on Android >= 6 grant Camera
and Microphone
permissions from Settings->Apps->YourApp->Permissions
.
Storage
permission is required to support message attachments.
Create a user with a password authentication:
b6.session.signup({identity: 'usr:john', password: 'secret'}, function(err) {
if (err) {
console.log('login error', err);
} else {
console.log('login successful');
}
});
Send a message to another user:
b6.compose('usr:tom').text('Hello!').send(function(err) {
if (err) {
console.log('error', err);
} else {
console.log('message sent');
}
});
Make a video call:
// Start an outgoing call and get a call controller (Dialog)
var d = b6.startCall('usr:tom', {audio: true, video: true});
Bit6 Cordova Plugin exposes the same API as Bit6 JS SDK. Check Bit6 JS documentation.
The complete source code is available in the demo repo. Check out the same demo app running with JS SDK at http://demo.bit6.com.
- iOS
- Android
- Browser
Push Notification support is required for receiving incoming calls and messages.
To enable this functionality please add one of these push plugins to your project:
-
phonegap-plugin-push (recommended)
# Set any value for SENDER_ID. Bit6 plugin will override it with the correct one. $ cordova plugin add phonegap-plugin-push --variable SENDER_ID="XXXXXXX"
-
$ cordova plugin add https://github.com/Telerik-Verified-Plugins/PushNotification
-
Legacy PhoneGap Push Plugin If you use cordova-ios 3.x
Then complete platform-specific configuration:
-
iOS APNs (detailed guide)
- Generate APNS certificate in iTunes Connect.
- Export it into a p12 file.
- Add the file to your app in Bit6 Dashboard.
-
Android GCM (detailed guide)
- Get the project number and server key from Google Dev Console.
- Add project number and server key for your app in Bit6 Dashboard.
Please disable Bitcode support when building your Cordova app with Xcode.
Go to Build Settings
, set Enable Bitcode
to No
.
Bit6 plugin leverages code from the excellent WebRTC, PhoneRTC and phonegap-websocket projects.