Android SDK
Building an Android application with Augmented Reality support from the ConfigWise SDK AR Framework is achieved by the following steps. Simply followed them to get the sample application from Github built and running on your mobile device. This AR Framework makes working with the underlying Google AR Framework much simpler and faster to work with.
Software development pre-requisites:
Android Studio 4.x, (Windows/Mac/Linux OS)
SDK Manager, with SDK Platform 9.0 or newer and the latest NDK with build tools 30.x
AVD Manager, with a virtual machine on at least API 29 (Android 9 with Google play store)
Gradle 6.x build tools (they come via Android Studio)
A computer with minimum 8GB RAM and a intel core-i5 cpu.
A mobile device with minimum Android release Nougat 7.0.
Download
First download the application’s example code from github.
https://github.com/configwise/configwise-sdk-android/archive/master.zip
Unzip the archive into your projects folder.
$ cd projects $ unzip ../Downloads/master.zip
When unpacked open the Android Studio and select “open existing project”
Select the project's subfolder configwise-sdk-android-master where you just unzipped the github code you downloaded.
Upon parsing the configwise-sdk-android project files let Android Studio install all missing and update any outdated plugins/gradle components. Might take a minute or two.
Sample output:
Download https://services.gradle.org/distributions/gradle-6.1.1-all.zip (138.58 MB) Download https://services.gradle.org/distributions/gradle-6.1.1-all.zip finished succeeded, took 1 m 30 s 788 ms Starting Gradle Daemon...Gradle Daemon started in 1 s 161 ms File /home/user/.android/repositories.cfg could not be loaded. Checking the license for package Android SDK Build-Tools 30.0.1 in /home/user/Android/Sdk/licenses License for package Android SDK Build-Tools 30.0.1 accepted. Preparing "Install Android SDK Build-Tools 30.0.1 (revision: 30.0.1)"." Install Android SDK Build-Tools 30.0.1 (revision: 30.0.1)" ready. Installing Android SDK Build-Tools 30.0.1 in /home/user/Android/Sdk/build-tools/30.0.1" Install Android SDK Build-Tools 30.0.1 (revision: 30.0.1)" complete. "Install Android SDK Build-Tools 30.0.1 (revision: 30.0.1)" finished. KotlinDsl ScriptsParameter(correlationId=3695620766269497, scriptFiles=[]) => StandardKotlinDsl ScriptsModel(scripts=[], commonModel=CommonKotlinDsl ScriptModel(classPath=[], sourcePath=[], implicitImports=[]), dehydratedScriptModels={}) - took 0.014 secs
Then restart Android Studio to take the plugins into use.
Authorization
Open the example application Java file in this location: app/src/main/java/io/configwise/android/sdk_example/"myappplication.java"
private void initConfigWiseSdk() { ConfigWiseSDK.initialize(new ConfigWiseSDK.Builder(this) .sdkVariant(ConfigWiseSDK.SdkVariant.B2C) .companyAuthToken("YOUR_COMPANY_AUTH_TOKEN") .debugLogging(false) .debug3d(false) ); }
You can see it needs a token instead of the “YOUR_COMPANY_AUTH_TOKEN” . This token enables the download of the AR objects stored in the ConfigWise backend system.
The token is generated in the CBO (ConfigWise Back Office) page.
https://manage.configwise.io/configwise/cbo/profile
We use here a single company-wide token since we don’t need single user logins.
You need an account to https://configwise.io to be able to update the 3D product catalog with the products you want to display in the AR application. The 3D objects are downloaded from the ConfigWise API as well as the application layout and child object structure.
Build
Paste the token in the file and in Android Studio re-build the application.
Build -> make build build analyzer: No warnings detected for this build. build output:
Tip: if you notice some 10+ deprecation warnings appear in the controllers/BaseActivity.java code you need to update the NDK “side by side” and Build tools to the latest version that Android Studio suggest.
WARNING: Compatible side by side NDK version was not found. Default is 21.0.6113669.
Compatible side by side NDK version was not found. Default is 21.0.6113669.
Make sure you update all Android Studio build tools to latest 30.0 and install/upgrade the side-by-side NDK.
Menu tools > sdk manager > sdk tools > check NDK
and update the rest of the software via.
Menu Help > Check for Updates
When the build is passed you can deploy the freshly built ConfigWise SDK Example application onto a vritual started from the AVD manager or on a real mobile attached via a USB cable.
Alternatively you could compile the APK and copy the file app-debug.apk to your mobile via a weblink, google drive or email attachment.
Launch
When all previous steps went well you should have the application launched. The Virtual Machine is not capable of Augment Reality in the videocamera even if you have camera working on your laptop. It really need the Google Play Service for AR installed on a real device that is compatible.
https://developers.google.com/ar/discover/supported-devices
The final end result of the running ConfigWise example application for Android looks like: