welcome to linkAR technical documentation

next

previous

Quick Start

2.1.- Setting up the Development Environment


If you are new to Android developing the following steps will guide you through the very basics of getting started with Android Google mobile development.
If you already are an Android developer and have the development environment set up, skip to Create new project.

Read more in Android's developer site

2.1.1.- Become an Android Developer


Important !! 3D Engine applications can not run in the simulator,and must be deployed on Android devices.
You must install a suitable Android java Developmet environment (The most common is Eclipse) to run applications on Android devices.

All the relevant information on how to install and prepare development environment can be found at Android's: Installing the SDK


2.2.- Installing 3D Render Engine Framework and creating a Hello World

2.2.1.- Create new project (Eclipse)


Select from upper menu: (File → New → Android Project) to create a new android project. Another option (File → New → Other → Android Project)

2.2.2.- Fill project details


1.Set proper project name

2.Select Build target
The lowest target selected should be 2.3.3

3.Fill in the package name and Main activity name if necessary (The lowest target should be 2.3.3)

The best practice is to create package name that consists of 3 names divided by 2 dots (Example: com.coolproject.test). Package name is very important, it represents your application and act as a unique identifier.
Also the package name is used in the process of receiving an API_KEY for the 3D Engine lib, therefore it is crucial to make a good and valid package name.


2.3.- SDK Files

SDK lib files and a sample project can be downloaded from 3D Engine SDK


2.4.- Create and configure the project

2.4.1.- Copy Libs directory to the project

Download and extract the lib.zip folder

All the needed SDK files will be located in the libs folder.

The folders should maintain the same structure and integrity as they are provided:

* libs/
  * armeabi-v7a/
    * libEADEngineLight.so
    * libEADUtilities.so
  * 3dEngine.jar
 


Copy the whole libs directory from SDK package provided - into your project


2.4.2.- Link Lib files to your project path


To link 3dEngine.jar file to your project click right mouse button on project folder and select Properties



In the window select Java Build Path and Libraries .

In the Libraries section select Add JARs. In the opened window find your project and select the jar file from the libs directory

After successful Linking , the added .jar's should appear in the Libraries section.



2.4.3.- Add Data folder

Search the folder under the Hello3dLite project.

  • Samples
    • Hello3dLite
      • Data
        • Models


Add the folder into assets folder.

2.4.4.- Starting to Code and creating your first 3D Engine based Application


Add imports to the main activity class. ( The MainActivity.java of the sample project)

package com.arlab.hello3dlite;
 
import java.util.ArrayList;
import java.util.List;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
 
import com.arlab.enginelight.EAGLView;
import com.arlab.enginelight.EngineRenderCallbacks;
import com.arlab.enginelight.SensorDataManager;
 
@SuppressLint({ "FloatMath", "FloatMath" })
public class MainActivity extends Activity implements EngineRenderCallbacks {
 
}

Those imports are needed in order to use 3D Engine lib classes.


2.4.5.- Add permissions and other changes to AndroidManifest.xml


For detailed explanation of AndroidManifest look here LINK


The folowing permissions must be added in AndroidManifest Extras area

  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>


We have to create a new xml file: Press Right Button over the res folder → new → Android XML File:

Select Values at Resource Type, name it style.xml:

Add The following style parameter:

<resources>
 
    <style name="AppTheme" parent="android:Theme.Light" />
 
</resources>


and the following fields must be added in the application tag at the AndroidManifest

android:theme="@style/AppTheme"

Final AndroidManifest should look like that:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.arlab.hello3dlite"
    android:versionCode="1"
    android:versionName="1.0" >
 
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
 
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:screenOrientation="portrait"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
 
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
 
</manifest>


2.4.6.- Create Default 3D Engine view instance

In order to start using The 3D Engine you need to create an instance of EAGLView (EAGLView.java) int the onCreate() method of your activity and add the view instance to content view.

public class MainActivity extends Activity implements EngineRenderCallbacks {
...
private EAGLView gl3DEngine;
@Override protected void onCreate(Bundle icicle) {
   super.onCreate(icicle);
 
/** Create the OpenGL view instance  */
        gl3DEngine = new EAGLView(this, "YOUR API KEY", this);	 
 
 
       /** Set library instance to view content  */
        setContentView(gl3DEngine);
        }
 
 
 

And finally add the callback functions, we will explain later how to use them:

       @Override
   	public void onEngineInit(int arg0, int arg1) {
   		//load model
                loadEADScene();
   	}
   	@Override
   	public void onRenderFrame() {
 
   		// needed function call.
   		gl3DEngine.drawFrame();
   	}


2.5.- How to Run


  • Connect android device by USB cable
  • Select the project folder from Package Explorer menu and press run button, for the first time will appear small window with different choices from which you should pick up “Android Application”.



  • Select your running device


2.6.- How to Debug


  • After running, make a breakpoint at the desired line to stop the debugger on runtime.
  • To make a breakpoint, click on the left margin of the line twice and a blue circle will appear indicating a new breakpoint was set.
  • Click on the debug (Bug button) to start debugging.


2.7.- How to upload the application to Google Play