Getting Started Android

From Kudan AR Engine
Jump to: navigation, search

This tutorial will show you how to setup an augmented reality project on Android using KudanAR.

  • Step 1: Download the Android KudanAR framework.
  • Step 2: Create a new project in Android Studio using one of the package IDs listed on the Development Licence Keys page.

Android1

  • Step 3: Import the .aar package to your project by going to (File -> New -> New Module...) and selecting Import .JAR/.AAR package.
  • Step 4: Go to (File -> Project Structure...), select your app module, click the dependencies tab, click the plus in the lower left and select Module Dependancy to add KudanAR as a dependancy to your project.
  • Step 5: Add these permissions and settings to your Android manifest.
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
 
<activity android:name=".Foo"
...  
android:configChanges="orientation|screenSize"
android:screenOrientation="fullSensor">
   ...
 </activity>

Note: If you are building for Android 6.0 and above you will need to include a permissions request for the camera before opening your ARActivity. Androids permission request documentation.

  • Step 6: Add the following to the Android block of the build.gradle file in your app module to prevent Android Studio compressing important files.
android 
{
...
    aaptOptions 
    {
       noCompress 'KARMarker'
       noCompress 'armodel'
    }
}
  • Step 7: Import eu.kudan.kudan.ARAPIKey into your main activity.
  • Step 8: Find your package ID’s corresponding API key on the Development Licence Keys page and set it in your app main activity.
ARAPIKey key = ARAPIKey.getInstance();
key.setAPIKey("Your APIKey here");
  • Step 9: Ensure the Activity you wish to display your AR content is a subclass of ARActivity.
  • Step 10: Place your AR content inside the setup() method.
  • Step 11: add the following to your activity in you