This documentation explains how to generate android APK files
RTCMultiConnection v3 supports cordova/ionic/phonegap (webviews).
For more information: docs/ios-android.md
Want to build iOS apps? Check this: Write iOS apps
name | link |
---|---|
Oracle Java Development Kit (JDK) | http://www.oracle.com/technetwork/java/javase/downloads/ |
Apache Ant | http://www.apache.org/dist/ant/binaries/ |
Android SDK | http://developer.android.com/sdk/index.html |
For a clear (comprehensive) guide, please check: appache: installing-the-requirements
cordova requirements
Above command will/should display a result similar to this:
Java JDK: installed
Android SDK: installed
Android target: installed android-23,Google Inc.:Google APIs:23
Gradle: installed ----------------- this one seems redundant
Please make sure to re-install the prerequisites if you get different result.
cordova create RTCMultiConnection com.rtcmulticonnection.demo RTCMultiConnection
cd RTCMultiConnection
Now you need to change following files:
name | path | description | demo file |
---|---|---|---|
index.html | www/index.html | Android app shows this HTML | demo file |
index.js | www/js/index.js | this is the backbone; here you do everything! | demo file |
config.xml | config.xml | here you set plugins, platforms, and attributes | demo file |
AndroidManifest.xml | platforms/android/AndroidManifest.xml | your android APK requires this file | demo file |
<link type="text/css" href="css/index.css">
<script src="cordova.js"></script>
<script src="js/socket.io.js"></script>
<script src="js/RTCMultiConnection.js"></script>
<script src="js/index.js"></script>
var app = {
initialize: function() {
app.bindEvents();
},
bindEvents: function() {
document.addEventListener('deviceready', app.onDeviceReady, false);
},
onDeviceReady: function() {
// here goes your real RTCMultiConnection codes
var connection = new RTCMultiConnection();
connection.socketURL = 'https://yourWebSite.com:9001/';
connection.openOrJoin('roomid');
}
};
app.initialize();
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.rtcmulticonnection.demo" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>RTCMultiConnection</name>
<icon src="www/img/icon.png" />
<content src="index.html" />
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" />
<platform name="android">
<preference name="Orientation" value="default" />
<preference name="KeepRunning" value="true" />
<preference name="AndroidLaunchMode" value="singleTop" />
</platform>
<preference name="xwalkVersion" value="23+" />
<preference name="xwalkCommandLine" value="--disable-pull-to-refresh-effect" />
<preference name="xwalkMode" value="embedded" />
<preference name="xwalkMultipleApk" value="true" />
<plugin name="cordova-plugin-whitelist" spec="latest" />
<plugin name="cordova-plugin-device" spec="latest" />
<plugin name="cordova-plugin-crosswalk-webview" spec="latest" />
</widget>
Please modify following XML attributes:
description | example code |
---|---|
"id" attribute: It should be something like this: |
|
"name" attribute: Name should NOT have spaces or special characters. Consider it as a "username": |
|
"icon" attribute: You can replace "icon.png" file with your own app-icon. |
<?xml version='1.0' encoding='utf-8'?>
<manifest android:versionName="1.0.0" package="com.rtcmulticonnection.demo">
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="25" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MICROPHONE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</manifest>
cordova platform add android
cordova build android
You can find the generated APK here:
project-directory/platforms/android/build/outputs/apk/android-armv7-debug.apk