Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
[RN] Add initial Jitsi Meet SDK for Android
Saúl Ibarra Corretgéddea60efe960
diff --git a/android/README.md b/android/README.mdnew file mode 100644index 0000000000..1f1f42b439--- /dev/null+++ b/android/README.md@@ -0,0 +1,134 @@+# Jitsi Meet for Android++This directory contains the source code for Jitsi Meet for Android (the+application) and the Jitsi Meet SDK for Android.++## Jitsi Meet SDK++Jitsi Meet SDK is an Android library which embodies the Jitsi Meet experience,+gift-wrapped so other applications can use it. Example use:++```java+package org.jitsi.example;++import android.support.v7.app.AppCompatActivity;+import android.os.Bundle;++import org.jitsi.meet.sdk.*;+++public class CustomActivity extends AppCompatActivity {+ private JitsiMeetView jitsiMeetView;++ @Override+ public void onBackPressed() {+ if (!JitsiMeetView.onBackPressed()) {+ // Invoke the default handler if it wasn't handled by React.+ super.onBackPressed();+ }+ }++ @Override+ protected void onCreate(Bundle savedInstanceState) {+ super.onCreate(savedInstanceState);++ jitsiMeetView = new JitsiMeetView(this);+ jitsiMeetView.loadURL(null);++ setContentView(jitsiMeetView);+ }++ @Override+ public void onNewIntent(Intent intent) {+ JitsiMeetView.onNewIntent(intent);+ }++ @Override+ protected void onDestroy() {+ super.onDestroy();+ JitsiMeetView.onHostDestroy(this);+ }++ @Override+ protected void onPause() {+ super.onPause();+ JitsiMeetView.onHostPause(this);+ }++ @Override+ protected void onResume() {+ super.onResume();+ JitsiMeetView.onHostResume(this);+ }++}+```++Alternatively, you can use the `JitsiMeetBaseActivity` class, which already has+all activity lifecycle methods hooked up:++```java+package org.jitsi.example;++import org.jitsi.meet.sdk.*;+++public class MainActivity extends JitsiMeetBaseActivity {+}++```++### JitsiMeetBaseActivity++This class encapsulates a high level API in the form of an Android activity+which displays a single `JitsiMeetView` views.++#### loadURL(url)++See JitsiMeetView.loadURL.+++### JitsiMeetView++The `JitsiMeetView` class is the core of Jitsi Meet SDK. It's designed to+display a Jitsi Meet conference view (or a welcome page).++#### loadURL(url)++Loads the given URL and joins the conference which is being pointed to. If null,+it will load the welcome page.++#### onBackPressed()++Helper method which should be called from the activity's `onBackPressed` method.+If this function returns `true` it means the action was handled and thus no+extra processing is required, otherwise the application should call the parent's+`onBackPressed` method.++This is a static method.++#### onHostDestroy(activity)++Helper method which should be called from the activity's `onDestroy` method.++This is a static method.++#### onHostPause(activity)++Helper method which should be called from the activity's `onPause` method.++This is a static method.++#### onHostResume(activity)++Helper method which should be called from the activity's `onResume` method.++This is a static method.++#### onNewIntent(intent)++Helper method for integrating the *deep linking* functionality. If your+application's activity is launched in "singleTask" mode this method should+be called from the activity's `onNewIntent` method.++This is a static method.diff --git a/android/app/BUCK b/android/app/BUCKdeleted file mode 100644index 40a21d532c..0000000000--- a/android/app/BUCK+++ /dev/null@@ -1,66 +0,0 @@-import re--# To learn about Buck see [Docs](https://buckbuild.com/).-# To run your application with Buck:-# - install Buck-# - `npm start` - to start the packager-# - `cd android`-# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`-# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck-# - `buck install -r android/app` - compile, install and run application-#--lib_deps = []-for jarfile in glob(['libs/*.jar']):- name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile)- lib_deps.append(':' + name)- prebuilt_jar(- name = name,- binary_jar = jarfile,- )--for aarfile in glob(['libs/*.aar']):- name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile)- lib_deps.append(':' + name)- android_prebuilt_aar(- name = name,- aar = aarfile,- )--android_library(- name = 'all-libs',- exported_deps = lib_deps-)--android_library(- name = 'app-code',- srcs = glob([- 'src/main/java/**/*.java',- ]),- deps = [- ':all-libs',- ':build_config',- ':res',- ],-)--android_build_config(- name = 'build_config',- package = 'org.jitsi.meet',-)--android_resource(- name = 'res',- res = 'src/main/res',- package = 'org.jitsi.meet',-)--android_binary(- name = 'app',- package_type = 'debug',- manifest = 'src/main/AndroidManifest.xml',- keystore = '//android/keystores:debug',- deps = [- ':app-code',- ],-)diff --git a/android/app/build.gradle b/android/app/build.gradleindex ea79ef6b3b..b2ad8cbb0b 100644--- a/android/app/build.gradle+++ b/android/app/build.gradle@@ -1,136 +1,38 @@apply plugin: 'com.android.application'-import com.android.build.OutputFile--/**- * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets- * and bundleReleaseJsAndAssets).- * These basically call `react-native bundle` with the correct arguments during the Android build- * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the- * bundle directly from the development server. Below you can see all the possible configurations- * and their defaults. If you decide to add a configuration block, make sure to add it before the- * `apply from: "../../node_modules/react-native/react.gradle"` line.- *- * project.ext.react = [- * // the name of the generated asset file containing your JS bundle- * bundleAssetName: "index.android.bundle",- *- * // the entry file for bundle generation- * entryFile: "index.android.js",- *- * // whether to bundle JS and assets in debug mode- * bundleInDebug: false,- *- * // whether to bundle JS and assets in release mode- * bundleInRelease: true,- *- * // whether to bundle JS and assets in another build variant (if configured).- * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants- * // The configuration property can be in the following formats- * // 'bundleIn${productFlavor}${buildType}'- * // 'bundleIn${buildType}'- * // bundleInFreeDebug: true,- * // bundleInPaidRelease: true,- * // bundleInBeta: true,- *- * // the root of your project, i.e. where "package.json" lives- * root: "../../",- *- * // where to put the JS bundle asset in debug mode- * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",- *- * // where to put the JS bundle asset in release mode- * jsBundleDirRelease: "$buildDir/intermediates/assets/release",- *- * // where to put drawable resources / React Native assets, e.g. the ones you use via- * // require('./image.png')), in debug mode- * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",- *- * // where to put drawable resources / React Native assets, e.g. the ones you use via- * // require('./image.png')), in release mode- * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",- *- * // by default the gradle tasks are skipped if none of the JS files or assets change; this means- * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to- * // date; if you have any other folders that you want to ignore for performance reasons (gradle- * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/- * // for example, you might want to remove it from here.- * inputExcludes: ["android/**", "ios/**"],- *- * // override which node gets called and with what additional arguments- * nodeExecutableAndArgs: ["node"]- *- * // supply additional arguments to the packager- * extraPackagerArgs: []- * ]- */--apply from: '../../node_modules/react-native/react.gradle'--/**- * Set this to true to create two separate APKs instead of one:- * - An APK that only works on ARM devices- * - An APK that only works on x86 devices- * The advantage is the size of the APK is reduced by about 4MB.- * Upload all the APKs to the Play Store and people will download- * the correct one based on the CPU architecture of their device.- */-def enableSeparateBuildPerCPUArchitecture = false--/**- * Run Proguard to shrink the Java bytecode in release builds.- */-def enableProguardInReleaseBuilds = falseandroid {- compileSdkVersion 23- buildToolsVersion '23.0.1'+ compileSdkVersion rootProject.ext.compileSdkVersion+ buildToolsVersion rootProject.ext.buildToolsVersiondefaultConfig {applicationId 'org.jitsi.meet'- minSdkVersion 16- targetSdkVersion 22versionCode Integer.parseInt("${version}")versionName "1.4.${version}"++ minSdkVersion rootProject.ext.minSdkVersion+ targetSdkVersion rootProject.ext.targetSdkVersion+ndk {abiFilters 'armeabi-v7a', 'x86'}+packagingOptions {// The project react-native does not provide 64-bit binaries at the// time of this writing. Unfortunately, packaging any 64-bit// binaries into the .apk will crash the app at runtime on 64-bit// platforms.- exclude 'lib/x86_64/libjingle_peerconnection_so.so'- exclude 'lib/arm64-v8a/libjingle_peerconnection_so.so'- }- }- splits {- abi {- reset()- enable enableSeparateBuildPerCPUArchitecture- universalApk false // If true, also generate a universal APK- include 'armeabi-v7a', 'x86'+ exclude '/lib/mips64/**'+ exclude '/lib/arm64-v8a/**'+ exclude '/lib/x86_64/**'}}buildTypes {release {- minifyEnabled enableProguardInReleaseBuilds+ minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'}}- // applicationVariants are e.g. debug, release- applicationVariants.all { variant ->- variant.outputs.each { output ->- // For each separate APK per architecture, set a unique version code as described here:- // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits- def versionCodes = ['armeabi-v7a':1, 'x86':2]- def abi = output.getFilter(OutputFile.ABI)- if (abi != null) { // null for the universal-debug, universal-release variants- output.versionCodeOverride =- versionCodes.get(abi) * 1048576 + defaultConfig.versionCode- }- }- }}if (project.hasProperty('JITSI_SIGNING')@@ -139,21 +41,8 @@ if (project.hasProperty('JITSI_SIGNING')}dependencies {- compile project(':react-native-background-timer')- compile project(':react-native-immersive')- compile project(':react-native-keep-awake')- compile project(':react-native-vector-icons')- compile project(':react-native-webrtc')compile fileTree(dir: 'libs', include: ['*.jar'])- compile 'com.android.support:appcompat-v7:23.0.1'- compile 'com.facebook.react:react-native:+' // From node_modules-}--apply from: '../../node_modules/react-native-vector-icons/fonts.gradle'-// Run this once to be able to run the application with BUCK-// puts all compile dependencies into folder libs for BUCK to use-task copyDownloadableDepsToLibs(type: Copy) {- from configurations.compile- into 'libs'+ debugCompile project(path: ':sdk', configuration: 'debug')+ releaseCompile project(path: ':sdk', configuration: 'release')}diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xmlindex 63dfcd19ac..ab1e18ed48 100644--- a/android/app/src/main/AndroidManifest.xml+++ b/android/app/src/main/AndroidManifest.xml@@ -1,30 +1,8 @@-<manifest xmlns:android="http://schemas.android.com/apk/res/android"- package="org.jitsi.meet"- android:versionCode="1"- android:versionName="1.0">-- <!-- XXX: ACCESS_NETWORK_STATE is required by WebRTC. -->- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />- <uses-permission android:name="android.permission.BLUETOOTH" />- <uses-permission android:name="android.permission.CAMERA" />- <uses-permission android:name="android.permission.INTERNET" />- <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />- <uses-permission android:name="android.permission.RECORD_AUDIO" />- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>- <uses-permission android:name="android.permission.WAKE_LOCK"/>-- <uses-feature android:name="android.hardware.camera" />- <uses-feature android:name="android.hardware.camera.autofocus"/>-- <uses-sdk- android:minSdkVersion="16"- android:targetSdkVersion="23" />-+<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.jitsi.meet"><applicationandroid:allowBackup="true"android:icon="@mipmap/ic_launcher"android:label="@string/app_name"- android:name=".MainApplication"android:theme="@style/AppTheme"><activityandroid:configChanges="keyboard|keyboardHidden|orientation|screenSize"@@ -54,7 +32,5 @@<data android:scheme="org.jitsi.meet" /></intent-filter></activity>- <activity- android:name="com.facebook.react.devsupport.DevSettingsActivity" /></application></manifest>diff --git a/android/app/src/main/java/org/jitsi/meet/MainActivity.java b/android/app/src/main/java/org/jitsi/meet/MainActivity.javaindex f9876443f5..43e6640186 100644--- a/android/app/src/main/java/org/jitsi/meet/MainActivity.java+++ b/android/app/src/main/java/org/jitsi/meet/MainActivity.java@@ -1,46 +1,33 @@-package org.jitsi.meet;+/*+ * Copyright @ 2017-present Atlassian Pty Ltd+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */-import com.facebook.react.ReactActivity;-import com.facebook.react.ReactActivityDelegate;-import com.facebook.react.ReactRootView;+package org.jitsi.meet;-public class MainActivity extends ReactActivity {- /**- * {@inheritDoc}- *- * Overrides {@link ReactActivity#createRootActivityDelegate()} to customize- * the {@link ReactRootView} with a background color that is in accord with- * the JavaScript and iOS parts of the application and causes less perceived- * visual flicker than the default background color.- */- @Override- protected ReactActivityDelegate createReactActivityDelegate() {- return new ReactActivityDelegate(this, getMainComponentName()) {- /**- * {@inheritDoc}- *- * Overrides {@link ReactActivityDelegate#createRootView()} to- * customize the {@link ReactRootView} with a background color that- * is in accord with the JavaScript and iOS parts of the application- * and causes less perceived visual flicker than the default- * background color.- */- @Override- protected ReactRootView createRootView() {- ReactRootView rootView = super.createRootView();+import org.jitsi.meet.sdk.JitsiMeetBaseActivity;- rootView.setBackgroundColor(0xFF111111);- return rootView;- }- };- }- /**- * Returns the name of the main component registered from JavaScript.- * This is used to schedule rendering of the component.- */- @Override- protected String getMainComponentName() {- return "App";- }+/**+ * The one and only Activity that Jitsi Meet (the app) needs. The activity is launched in+ * "singleTask" mode, so it will be created upon application initialization and there will be+ * a single instance of it. Further attempts at launching the application once it was already+ * launched will result in <tt>onNewIntent</tt> being called.+ *+ * This Activity inherits from JitsiMeetBaseActivity without adding anything to it. It merely exists to+ * keep the React Native CLI working, since it always tries to launch an activity called+ * "MainActivity" when doing "react-native run-android".+ */+public class MainActivity extends JitsiMeetBaseActivity {}diff --git a/android/app/src/main/java/org/jitsi/meet/MainApplication.java b/android/app/src/main/java/org/jitsi/meet/MainApplication.javadeleted file mode 100644index 967de1b6e8..0000000000--- a/android/app/src/main/java/org/jitsi/meet/MainApplication.java+++ /dev/null@@ -1,65 +0,0 @@-package org.jitsi.meet;--import android.app.Application;--import com.facebook.react.ReactApplication;-import com.facebook.react.ReactNativeHost;-import com.facebook.react.ReactPackage;-import com.facebook.soloader.SoLoader;--import java.util.Arrays;-import java.util.List;--public class MainApplication extends Application implements ReactApplication {- private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {- /**- * {@inheritDoc}- */- @Override- public boolean getUseDeveloperSupport() {- return BuildConfig.DEBUG;- }-- /**- * {@inheritDoc}- */- @Override- protected List<ReactPackage> getPackages() {- return Arrays.<ReactPackage>asList(- new com.corbt.keepawake.KCKeepAwakePackage(),- new com.facebook.react.shell.MainReactPackage(),- new com.oblador.vectoricons.VectorIconsPackage(),- new com.ocetnik.timer.BackgroundTimerPackage(),- new com.oney.WebRTCModule.WebRTCModulePackage(),- new com.rnimmersive.RNImmersivePackage(),- new org.jitsi.meet.audiomode.AudioModePackage(),- new org.jitsi.meet.proximity.ProximityPackage()- );- }- };-- /**- * {@inheritDoc}- */- @Override- public ReactNativeHost getReactNativeHost() {- return mReactNativeHost;- }-- /**- * {@inheritDoc}- */- @Override- public void onCreate() {- super.onCreate();-- SoLoader.init(this, /* native exopackage */ false);-- if (!getReactNativeHost()- .getReactInstanceManager()- .getDevSupportManager()- .getDevSupportEnabled()) {- // TODO Auto-generated method stub- }- }-}diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xmlindex 9763a63135..7e0e9a25f8 100644--- a/android/app/src/main/res/values/styles.xml+++ b/android/app/src/main/res/values/styles.xml@@ -1,9 +1,7 @@<resources>-<!-- Base application theme. --><style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"><!-- Customize your theme here. --><item name="android:windowTranslucentStatus">true</item></style>-</resources>diff --git a/android/build.gradle b/android/build.gradleindex eed9972b5c..5b0d189a16 100644--- a/android/build.gradle+++ b/android/build.gradle@@ -22,3 +22,10 @@ allprojects {}}}++ext {+ compileSdkVersion = 23+ buildToolsVersion = "23.0.1"+ minSdkVersion = 16+ targetSdkVersion = 23+}diff --git a/android/sdk/.gitignore b/android/sdk/.gitignorenew file mode 100644index 0000000000..796b96d1c4--- /dev/null+++ b/android/sdk/.gitignore@@ -0,0 +1 @@+/builddiff --git a/android/sdk/build.gradle b/android/sdk/build.gradlenew file mode 100644index 0000000000..03ad47ce47--- /dev/null+++ b/android/sdk/build.gradle@@ -0,0 +1,108 @@+apply plugin: 'com.android.library'++android {+ compileSdkVersion rootProject.ext.compileSdkVersion+ buildToolsVersion rootProject.ext.buildToolsVersion++ defaultConfig {+ minSdkVersion rootProject.ext.minSdkVersion+ targetSdkVersion rootProject.ext.targetSdkVersion+ publishNonDefault true+ }++ buildTypes {+ debug {}+ release {+ minifyEnabled false+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'+ }+ }+}++dependencies {+ compile fileTree(dir: 'libs', include: ['*.jar'])++ compile 'com.android.support:appcompat-v7:23.0.1'+ compile 'com.facebook.react:react-native:+'++ compile project(':react-native-background-timer')+ compile project(':react-native-immersive')+ compile project(':react-native-keep-awake')+ compile project(':react-native-vector-icons')+ compile project(':react-native-webrtc')+}++// Build process helpers+//++void runBefore(String dependentTaskName, Task task) {+ Task dependentTask = tasks.findByPath(dependentTaskName);+ if (dependentTask != null) {+ dependentTask.dependsOn task+ }+}++gradle.projectsEvaluated {+ android.buildTypes.all { buildType ->+ def buildNameCapitalized = "${buildType.name.capitalize()}"+ def bundlePath = "${buildDir}/intermediates/bundles/${buildType.name}"++ // Bundle fonts in react-native-vector-icons+ //++ def currentFontTask = tasks.create(name: "${buildType.name}CopyFonts", type: Copy) {+ from("${projectDir}/../../node_modules/react-native-vector-icons/Fonts/")+ into("${bundlePath}/assets/fonts")+ }++ currentFontTask.dependsOn("merge${buildNameCapitalized}Resources")+ currentFontTask.dependsOn("merge${buildNameCapitalized}Assets")++ runBefore("processArmeabi-v7a${buildNameCapitalized}Resources", currentFontTask)+ runBefore("processX86${buildNameCapitalized}Resources", currentFontTask)+ runBefore("processUniversal${buildNameCapitalized}Resources", currentFontTask)+ runBefore("process${buildNameCapitalized}Resources", currentFontTask)++ // Bundle JavaScript and React resources+ // (adapted from react-native/react.gradle)+ //++ // React js bundle directories+ def jsBundleDir = file("${bundlePath}/assets")+ def resourcesDir = file("${bundlePath}/res/merged")+ def jsBundleFile = file("${jsBundleDir}/index.android.bundle")++ // Bundle task name for variant+ def bundleJsAndAssetsTaskName = "bundle${buildNameCapitalized}JsAndAssets"++ def currentBundleTask = tasks.create(+ name: bundleJsAndAssetsTaskName,+ type: Exec) {++ // Set up inputs and outputs so gradle can cache the result+ def reactRoot = file("${projectDir}/../../")+ inputs.files fileTree(dir: reactRoot, excludes: ["android/**", "ios/**"])+ outputs.dir jsBundleDir+ outputs.dir resourcesDir++ // Set up the call to the react-native cli+ workingDir reactRoot++ // Create JS bundle+ def devEnabled = !buildNameCapitalized.toLowerCase().contains("release")+ commandLine("node", "node_modules/react-native/local-cli/cli.js", "bundle", "--platform", "android", "--dev", "${devEnabled}",+ "--reset-cache", "--entry-file", "index.android.js", "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir)++ // TODO: disable task in Debug mode?+ }++ // Hook bundle${productFlavor}${buildType}JsAndAssets into the android build process+ currentBundleTask.dependsOn("merge${buildNameCapitalized}Resources")+ currentBundleTask.dependsOn("merge${buildNameCapitalized}Assets")++ runBefore("processArmeabi-v7a${buildNameCapitalized}Resources", currentBundleTask)+ runBefore("processX86${buildNameCapitalized}Resources", currentBundleTask)+ runBefore("processUniversal${buildNameCapitalized}Resources", currentBundleTask)+ runBefore("process${buildNameCapitalized}Resources", currentBundleTask)+ }+}diff --git a/android/sdk/proguard-rules.pro b/android/sdk/proguard-rules.pronew file mode 100644index 0000000000..706b24ceb5--- /dev/null+++ b/android/sdk/proguard-rules.pro@@ -0,0 +1,25 @@+# Add project specific ProGuard rules here.+# By default, the flags in this file are appended to flags specified+# in /Users/scorretge/Library/Android/sdk/tools/proguard/proguard-android.txt+# You can edit the include path and order by changing the proguardFiles+# directive in build.gradle.+#+# For more details, see+# http://developer.android.com/guide/developing/tools/proguard.html++# Add any project specific keep options here:++# If your project uses WebView with JS, uncomment the following+# and specify the fully qualified class name to the JavaScript interface+# class:+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {+# public *;+#}++# Uncomment this to preserve the line number information for+# debugging stack traces.+#-keepattributes SourceFile,LineNumberTable++# If you keep the line number information, uncomment this to+# hide the original source file name.+#-renamesourcefileattribute SourceFilediff --git a/android/sdk/src/main/AndroidManifest.xml b/android/sdk/src/main/AndroidManifest.xmlnew file mode 100644index 0000000000..27b346e237--- /dev/null+++ b/android/sdk/src/main/AndroidManifest.xml@@ -0,0 +1,21 @@+<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.jitsi.meet.sdk">+ <!-- XXX: ACCESS_NETWORK_STATE is required by WebRTC. -->+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />+ <uses-permission android:name="android.permission.BLUETOOTH" />+ <uses-permission android:name="android.permission.CAMERA" />+ <uses-permission android:name="android.permission.INTERNET" />+ <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />+ <uses-permission android:name="android.permission.RECORD_AUDIO" />+ <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>+ <uses-permission android:name="android.permission.WAKE_LOCK"/>++ <uses-feature android:name="android.hardware.camera" />+ <uses-feature android:name="android.hardware.camera.autofocus"/>++ <application android:allowBackup="true"+ android:label="@string/app_name"+ android:supportsRtl="true">+ <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />+ </application>++</manifest>diff --git a/android/app/src/main/assets/fonts/jitsi.ttf b/android/sdk/src/main/assets/fonts/jitsi.ttfsimilarity index 100%rename from android/app/src/main/assets/fonts/jitsi.ttfrename to android/sdk/src/main/assets/fonts/jitsi.ttfdiff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetBaseActivity.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetBaseActivity.javanew file mode 100644index 0000000000..92e0154a2b--- /dev/null+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetBaseActivity.java@@ -0,0 +1,144 @@+/*+ * Copyright @ 2017-present Atlassian Pty Ltd+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++package org.jitsi.meet.sdk;++import android.content.Intent;+import android.net.Uri;+import android.os.Build;+import android.provider.Settings;+import android.support.annotation.Nullable;+import android.support.v7.app.AppCompatActivity;+import android.os.Bundle;++import java.net.URL;+++/**+ * Base Activity for applications integrating Jitsi Meet at a higher level. It contains all the+ * required wiring between the <tt>JKConferenceView</tt> and the Activity lifecycle methods already+ * implemented.+ *+ * In this activity we use a single <tt>JKConferenceView</tt> instance. This instance gives us+ * access to a view which displays the welcome page and the conference itself. All lifetime methods+ * associated with this Activity are hooked to the React Native subsystem via proxy calls through+ * the <tt>JKConferenceView</tt> static methods.+ */+public class JitsiMeetBaseActivity extends AppCompatActivity {+ private JitsiMeetView jitsiMeetView;+ public static final int OVERLAY_PERMISSION_REQ_CODE = 4242;++ /**+ * Loads the given URL and displays the conference. If the specified URL is null, the welcome+ * page is displayed instead.+ *+ * @param url - The conference URL.+ */+ public void loadURL(@Nullable URL url) {+ jitsiMeetView.loadURL(url);+ }++ /**+ * {@inheritDoc}+ */+ @Override+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {+ if (requestCode == OVERLAY_PERMISSION_REQ_CODE) {+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {+ if (!Settings.canDrawOverlays(this)) {+ // Permission not granted...+ return;+ }+ }++ setContentView(jitsiMeetView);+ }+ }++ /**+ * {@inheritDoc}+ */+ @Override+ public void onBackPressed() {+ if (!JitsiMeetView.onBackPressed()) {+ // Invoke the default handler if it wasn't handled by React.+ super.onBackPressed();+ }+ }++ /**+ * {@inheritDoc}+ */+ @Override+ protected void onCreate(Bundle savedInstanceState) {+ super.onCreate(savedInstanceState);++ jitsiMeetView = new JitsiMeetView(this);+ jitsiMeetView.loadURL(null);++ /**+ * In debug mode React needs permission to write over other apps in order to display the+ * warning and error overlays.+ */+ if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&+ !Settings.canDrawOverlays(this)) {++ Intent intent+ = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,+ Uri.parse("package:" + getPackageName()));+ startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE);+ return;+ }++ setContentView(jitsiMeetView);+ }++ /**+ * {@inheritDoc}+ */+ @Override+ public void onNewIntent(Intent intent) {+ JitsiMeetView.onNewIntent(intent);+ }++ /**+ * {@inheritDoc}+ */+ @Override+ protected void onDestroy() {+ super.onDestroy();+ JitsiMeetView.onHostDestroy(this);+ }++ /**+ * {@inheritDoc}+ */+ @Override+ protected void onPause() {+ super.onPause();+ JitsiMeetView.onHostPause(this);+ }++ /**+ * {@inheritDoc}+ */+ @Override+ protected void onResume() {+ super.onResume();+ JitsiMeetView.onHostResume(this);+ }++}diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.javanew file mode 100644index 0000000000..3bce82c60f--- /dev/null+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java@@ -0,0 +1,176 @@+/*+ * Copyright @ 2017-present Atlassian Pty Ltd+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++package org.jitsi.meet.sdk;++import android.app.Activity;+import android.app.Application;+import android.content.Context;+import android.content.Intent;+import android.os.Bundle;+import android.support.annotation.NonNull;+import android.support.annotation.Nullable;+import android.widget.FrameLayout;++import com.facebook.react.ReactInstanceManager;+import com.facebook.react.ReactRootView;+import com.facebook.react.common.LifecycleState;++import java.net.URL;+++public class JitsiMeetView extends FrameLayout {+ /**+ * React Native root view.+ */+ private ReactRootView mReactRootView;++ /**+ * React Native bridge. The instance manager allows embedding applications to create multiple+ * root views off the same JavaScript bundle.+ */+ private static ReactInstanceManager mReactInstanceManager;++ /**+ * Background color used by this view and the React Native root view.+ */+ private static final int BACKGROUND_COLOR = 0xFF111111;++ public JitsiMeetView(@NonNull Context context) {+ super(context);++ setBackgroundColor(BACKGROUND_COLOR);++ if (mReactInstanceManager == null) {+ initReactInstanceManager(((Activity)context).getApplication());+ }+ }++ /**+ * Loads the given URL and displays the conference. If the specified URL is null, the welcome+ * page is displayed instead.+ *+ * @param url - The conference URL.+ */+ public void loadURL(@Nullable URL url) {+ Bundle props = new Bundle();++ if (url != null) {+ props.putString("url", url.toString());+ }++ if (mReactRootView == null) {+ mReactRootView = new ReactRootView(getContext());+ mReactRootView.startReactApplication(mReactInstanceManager, "App", props);+ mReactRootView.setBackgroundColor(BACKGROUND_COLOR);+ addView(mReactRootView);+ } else {+ // TODO: ReactRootView#setAppProperties is only available on React Native 0.45.+ throw new RuntimeException("Not yet supported");+ }+ }++ /**+ * Internal method to initialize the React Native instance manager. We create a single instance+ * in order to load the JavaScript bundle a single time. All <tt>ReactRootView</tt> instances+ * will be tied to the one and only <tt>ReactInstanceManager</tt>.+ *+ * @param application - <tt>Application</tt> instance which is running.+ */+ private static void initReactInstanceManager(Application application) {+ mReactInstanceManager = ReactInstanceManager.builder()+ .setApplication(application)+ .setBundleAssetName("index.android.bundle")+ .setJSMainModuleName("index.android")+ .addPackage(new com.corbt.keepawake.KCKeepAwakePackage())+ .addPackage(new com.facebook.react.shell.MainReactPackage())+ .addPackage(new com.oblador.vectoricons.VectorIconsPackage())+ .addPackage(new com.ocetnik.timer.BackgroundTimerPackage())+ .addPackage(new com.oney.WebRTCModule.WebRTCModulePackage())+ .addPackage(new com.rnimmersive.RNImmersivePackage())+ .addPackage(new org.jitsi.meet.sdk.audiomode.AudioModePackage())+ .addPackage(new org.jitsi.meet.sdk.proximity.ProximityPackage())+ .setUseDeveloperSupport(BuildConfig.DEBUG)+ .setInitialLifecycleState(LifecycleState.RESUMED)+ .build();+ }++ /**+ * Activity lifecycle method which should be called from <tt>Activity.onBackPressed</tt> so+ * we can do the required internal processing.+ *+ * @return - true if the back-press was processed, false otherwise. In case false is returned+ * the application should call the parent's implementation.+ */+ public static boolean onBackPressed() {+ if (mReactInstanceManager != null) {+ mReactInstanceManager.onBackPressed();+ return true;+ } else {+ return false;+ }+ }++ /**+ * Activity lifecycle method which should be called from <tt>Activity.onDestroy</tt> so+ * we can do the required internal processing.+ *+ * @param activity - <tt>Activity</tt> being destroyed.+ */+ public static void onHostDestroy(Activity activity) {+ if (mReactInstanceManager != null) {+ mReactInstanceManager.onHostDestroy(activity);+ }+ }++ /**+ * Activity lifecycle method which should be called from <tt>Activity.onPause</tt> so+ * we can do the required internal processing.+ *+ * @param activity - <tt>Activity</tt> being paused.+ */+ public static void onHostPause(Activity activity) {+ if (mReactInstanceManager != null) {+ mReactInstanceManager.onHostPause(activity);+ }+ }++ /**+ * Activity lifecycle method which should be called from <tt>Activity.onResume</tt> so+ * we can do the required internal processing.+ *+ * @param activity - <tt>Activity</tt> being resumed.+ */+ public static void onHostResume(Activity activity) {+ if (mReactInstanceManager != null) {+ mReactInstanceManager.onHostResume(activity, null);+ }+ }++ /**+ * Activity lifecycle method which should be called from <tt>Activity.onNewIntent</tt> so+ * we can do the required internal processing. Note that this is only needed if the activity's+ * "launchMode" was set to "singleTask". This is required for deep linking to work once the+ * application is already running.+ *+ * @param intent - <tt>Intent</tt> instance which was received.+ */+ public static void onNewIntent(Intent intent) {+ if (mReactInstanceManager != null) {+ mReactInstanceManager.onNewIntent(intent);+ }+ }+}diff --git a/android/app/src/main/java/org/jitsi/meet/audiomode/AudioModeModule.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/audiomode/AudioModeModule.javasimilarity index 94%rename from android/app/src/main/java/org/jitsi/meet/audiomode/AudioModeModule.javarename to android/sdk/src/main/java/org/jitsi/meet/sdk/audiomode/AudioModeModule.javaindex 66292cc808..49f4a0b4ce 100644--- a/android/app/src/main/java/org/jitsi/meet/audiomode/AudioModeModule.java+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/audiomode/AudioModeModule.java@@ -1,4 +1,20 @@-package org.jitsi.meet.audiomode;+/*+ * Copyright @ 2017-present Atlassian Pty Ltd+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++package org.jitsi.meet.sdk.audiomode;import android.annotation.TargetApi;import android.content.BroadcastReceiver;diff --git a/android/app/src/main/java/org/jitsi/meet/audiomode/AudioModePackage.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/audiomode/AudioModePackage.javasimilarity index 64%rename from android/app/src/main/java/org/jitsi/meet/audiomode/AudioModePackage.javarename to android/sdk/src/main/java/org/jitsi/meet/sdk/audiomode/AudioModePackage.javaindex baedd37b38..c2f311cfa6 100644--- a/android/app/src/main/java/org/jitsi/meet/audiomode/AudioModePackage.java+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/audiomode/AudioModePackage.java@@ -1,4 +1,20 @@-package org.jitsi.meet.audiomode;+/*+ * Copyright @ 2017-present Atlassian Pty Ltd+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++package org.jitsi.meet.sdk.audiomode;import com.facebook.react.ReactPackage;import com.facebook.react.bridge.JavaScriptModule;diff --git a/android/app/src/main/java/org/jitsi/meet/audiomode/BluetoothHeadsetMonitor.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/audiomode/BluetoothHeadsetMonitor.javasimilarity index 90%rename from android/app/src/main/java/org/jitsi/meet/audiomode/BluetoothHeadsetMonitor.javarename to android/sdk/src/main/java/org/jitsi/meet/sdk/audiomode/BluetoothHeadsetMonitor.javaindex f66d1ab338..124754e30d 100644--- a/android/app/src/main/java/org/jitsi/meet/audiomode/BluetoothHeadsetMonitor.java+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/audiomode/BluetoothHeadsetMonitor.java@@ -1,7 +1,22 @@-package org.jitsi.meet.audiomode;+/*+ * Copyright @ 2017-present Atlassian Pty Ltd+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++package org.jitsi.meet.sdk.audiomode;import android.bluetooth.BluetoothAdapter;-import android.bluetooth.BluetoothDevice;import android.bluetooth.BluetoothHeadset;import android.bluetooth.BluetoothProfile;import android.content.BroadcastReceiver;diff --git a/android/app/src/main/java/org/jitsi/meet/proximity/ProximityModule.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/proximity/ProximityModule.javasimilarity index 82%rename from android/app/src/main/java/org/jitsi/meet/proximity/ProximityModule.javarename to android/sdk/src/main/java/org/jitsi/meet/sdk/proximity/ProximityModule.javaindex 2dccd83785..e605243ee9 100644--- a/android/app/src/main/java/org/jitsi/meet/proximity/ProximityModule.java+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/proximity/ProximityModule.java@@ -1,4 +1,20 @@-package org.jitsi.meet.proximity;+/*+ * Copyright @ 2017-present Atlassian Pty Ltd+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++package org.jitsi.meet.sdk.proximity;import android.content.Context;import android.os.PowerManager;diff --git a/android/app/src/main/java/org/jitsi/meet/proximity/ProximityPackage.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/proximity/ProximityPackage.javasimilarity index 64%rename from android/app/src/main/java/org/jitsi/meet/proximity/ProximityPackage.javarename to android/sdk/src/main/java/org/jitsi/meet/sdk/proximity/ProximityPackage.javaindex ca2ccec490..42544cbbb6 100644--- a/android/app/src/main/java/org/jitsi/meet/proximity/ProximityPackage.java+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/proximity/ProximityPackage.java@@ -1,4 +1,20 @@-package org.jitsi.meet.proximity;+/*+ * Copyright @ 2017-present Atlassian Pty Ltd+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++package org.jitsi.meet.sdk.proximity;import com.facebook.react.ReactPackage;import com.facebook.react.bridge.JavaScriptModule;diff --git a/android/sdk/src/main/res/values/strings.xml b/android/sdk/src/main/res/values/strings.xmlnew file mode 100644index 0000000000..6aed30d156--- /dev/null+++ b/android/sdk/src/main/res/values/strings.xml@@ -0,0 +1,3 @@+<resources>+ <string name="app_name">Jitsi Meet SDK</string>+</resources>diff --git a/android/settings.gradle b/android/settings.gradleindex edf41e8a13..b062a0e0e4 100644--- a/android/settings.gradle+++ b/android/settings.gradle@@ -1,6 +1,6 @@rootProject.name = 'jitsi-meet'-include ':app'+include ':app', ':sdk'include ':react-native-background-timer'project(':react-native-background-timer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-background-timer/android')include ':react-native-immersive'