ApiRTC on Apache Cordova
Our tutorial will guide you through the steps of developing and implementing our ApiRTC Basic Call feature on an Android and/or iOS device.
But if you want to skip to the code, clone our repo right here on Github.
What is Cordova?
Apache Cordova is an open-source mobile development framework. By using Cordova and our ApiRTC technology, you will be able to develop cross-platform applications even on iOS devices.
iOS?
ApiRTC can be used on Safari and you can also develop an hybrid app through Cordova to use apiRTC on iOS devices. As you will see later on in this tutorial, some additional plugins will be required to allow full webRTC compliance.
On with the project!
Environment and requirements
- Android SDK : Link
- XCode (for Mac users)
- NodeJS
- NPM
The last step of setting your environment will be to install Cordova:
npm install -g cordova ios-deploy
Cordova project
Now let’s create a brand-new Cordova project and upload our ApiRTC basic call feature on both platforms: iOS and Android
cordova create [nameOfYourProject] cd [nameOfYourProject] git clone https://github.com/apizee/ApiRTC-mobile.git cordova plugin add cordova-plugin-console cordova plugin add cordova-custom-config cordova plugin add cordova-plugin-device cordova plugin add cordova-plugin-iosrtc cordova plugin add cordova-plugin-media cordova plugin add android-camera-permission cordova plugin add cordova-plugin-android-permissions@0.10.0 cordova platform add ios cordova platform add android
The index file
Edit the index.html file in your "www" folder to customize your apiRTC integration
Then, run an emulator or on a phone like this :
cordova build ios cordova run ios
cordova build android cordova run android --device
Let's test the application :
Open this link with Chrome to exchange with your mobile over webrtc. You will be able to establish a webRTC call between your app and your computer using the number that has been automatically assigned to your apiRTC Client.
Troubleshooting
Getting building errors? Have some questions? Check out explanation right here on Github.