Project Setup
7 min
This will explain how to set up your Android project before integrating this API.
Configure your project
The ARxAPI requires the following project configuration:
- minSdkVersion = 21
- versionTarget = 29
- versionCompiler = 29
Configure your Manifest
The ARxAPI requires the following authorizations. Make sure your Manifest requests them:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.usb.host" />In addition to permissions, the API requires the following intent. This intent must fit into your <activity></activity>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />In order for the Android system to detect the ARxWear headset you must add a device filter xml file containing the following:
<resources>
<!-- UVC(Miscellaneous device class) -->
<usb-device class="239" subclass="2" />
<!-- UVC Video control interface-->
<usb-device class="14" subclass="1" />
<!-- UVC Video stream interface-->
<usb-device class="14" subclass="2" />
</resources>Setup your Project's Build.gradle
Make sure your Project's gradle file includes the following:
buildscript {
repositories {
mavenCentral()
mavenLocal()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20'
}
}
allprojects {
repositories {
mavenCentral()
mavenLocal()
google()
maven { url 'https://jitpack.io' }
maven { url 'http://raw.github.com/saki4510t/libcommon/master/repository/' }
}
}
ext {
androidXVersion = '1.1.0'
commonLibVersion= '4.1.1'
versionCompiler = 29
versionTarget = 29
minSdkVersion = 21
javaSourceCompatibility = JavaVersion.VERSION_1_8
javaTargetCompatibility = JavaVersion.VERSION_1_8
}
Setup your Module's Build.gradle
Make sure your Module's gradle file includes the following:
android {
defaultConfig {
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
implementation files('../libs/arxapi.aar')
implementation "com.serenegiant:common:4.1.1"
implementation "com.google.android.material:material:1.4.0"
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.jakewharton.timber:timber:5.0.1'
}Add the ARxAPI.AAR
- Create a libs folder at the root of your project
- Copy the arxapi.aar to the libs folder.
- If not already done, make sure you added this to your Project's gradle file:
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
implementation files('../libs/arxapi.aar')
}