welcome to linkAR technical documentation

next previous

Quick Start

2.1.- Setting up the Development Environment


If you are new in Android developing the following steps will guide you through the very basics of getting started with Android Google mobile development.

Read more in Android's developer site

2.1.1.- Become an Android Developer


Important !! AR Browser 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 where to find , how to install and prepare development environment can be found here:

http://developer.android.com/sdk/installing.html

2.2.- Installing AR Browser 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. Other option (File → New → Other → Android Project)

Note: If you want only test the project you can import the project into eclipse, for example, choosing: File → Import → General → “Existing Project into Workspace” and run the application

2.2.2.- Fill project details


a) Set proper project name: HelloARlib

b) Select Build target
The lowest target selected should be 2.3.3

c) 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 three names divided by two dots (Example: com.coolproject.test). Package name is very important because it represents your application and act as a unique identifier. The name of the project is not important.
This name and the API_KEY associated with it are received for you when you get the ARBrowser SDK. In this case we use com.arlab and set its API_KEY in the code.


2.3.- SDK Files


SDK lib files and a sample project can be downloaded from ARBrowser SDK

2.4.- Create and configure the project HelloARlib

2.4.1.- Copy Libs directory to the project


Download and extract the lib.zip folder

SDK files contains two folders (libs and images). Those two folders should be copied into the project as described below. The folders should maintain the same structure and integrity that in the original zip:

* EADBrowser Framework
  * libs/
    * EADBrowser.jar
    * armeabi/
      * libEADBrowser.so
      * libEADUtilities.so
  * images/
    * lib images..


Copy (Drag and Drop) whole libs directory from SDK package provided - into your HelloARlib project root directory.


2.4.2.- Copy images directory to the project


Copy (Drag and Drop) whole images folder to the assets folder in your project

Copy also (Drag and Drop) the res→drawable-nodpi folder from samples→HelloARlib sample into your project.

2.4.3.- Link EADBrowser.jar file to your project path


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


In the appeared window select Java Build Path and Libraries .
In the Libraries section select Add JARs. In the opened window find your project and select EADBrowser.jar file from the libs directory



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



2.4.4.- Start coding and creating your first AR Browser based Application


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

package com.arlab;
 
import android.app.Activity;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
 
import com.arlab.arbrowser.general.ARbrowserView;
import com.arlab.arbrowser.general.POI;
import com.arlab.arbrowser.general.POIaction;
import com.arlab.arbrowser.general.POIlabel;
 
// R is in the gen folder of your project.
// If your package name is not com.arlab you have to change this import.
import com.arlab.R;
 
public class HelloARlibActivity extends Activity {
 
}

Those imports are needed in order to use AR browser lib classes.


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


For detailed explanation of AndroidManifest look here AndroidManifiest


The folowing premissions should be added in AndroidManifest Extras area



<uses-feature android:glEsVersion="0x00020000" android:required="true" />
 
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.CAMERA"/> 
<uses-feature android:name="android.hardware.camera"/> 
<uses-feature android:name="android.hardware.camera.autofocus"/>
 
<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/> 
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> 
<uses-permission android:name="android.permission.ACCESS_GPS"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>  
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>


The folowing fields must be added to Main activity preferences ( Needed for twitter functionality )

android:configChanges="orientation"    
android:screenOrientation="nosensor"
android:launchMode="singleTask"


The folowing parts of code must be added to Main activity (In order to support Twitter functionality)

<intent-filter>  
  <action android:name="android.intent.action.VIEW" />  
  <category android:name="android.intent.category.DEFAULT" />  
  <category android:name="android.intent.category.BROWSABLE" />  
  <data  android:scheme="callback" android:host="tweeter"/> 
</intent-filter>


Final AndroidManifest should look like that:


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.arlab"
    android:versionCode="1"
    android:versionName="1.0" >
 
    <uses-sdk android:minSdkVersion="10" />
 
    <!-- Allows use of openGL ES 2.0 -->
    <uses-feature android:glEsVersion="0x00020000" android:required="true" />
 
	<uses-permission android:name="android.permission.WAKE_LOCK"/>
	<uses-permission android:name="android.permission.CAMERA"/> 
	<uses-feature android:name="android.hardware.camera"/> 
	<uses-feature android:name="android.hardware.camera.autofocus"/>
 
	<uses-permission android:name="android.permission.INTERNET"/> 
	<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
	<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/> 
	<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> 
	<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> 
	<uses-permission android:name="android.permission.ACCESS_GPS"/>
	<uses-permission android:name="android.permission.WRITE_SETTINGS"/> 
	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>  
	<uses-permission android:name="android.permission.CALL_PHONE"/> 
	<uses-permission android:name="android.permission.READ_PHONE_STATE"/> 
 
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
 
        <activity
            android:name="com.arlab.HelloARlibActivity"
            android:label="@string/app_name" 
            android:configChanges="orientation"    
            android:screenOrientation="nosensor"         
            android:launchMode="singleTask"  >    <!-- Needed for twitter functionality -->
 
            <intent-filter>
              <action android:name="android.intent.action.MAIN" />
              <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
 
 
            <!-- Intent filter used to catch Twitter authorization callback (Used in Twitter functionality) -->
            <intent-filter>  
  	      <action android:name="android.intent.action.VIEW" />  
  	      <category android:name="android.intent.category.DEFAULT" />  
  	      <category android:name="android.intent.category.BROWSABLE" />  
 	      <data  android:scheme="callback" android:host="tweeter"/>   					      									
	    </intent-filter>
 
        </activity>
    </application>
</manifest>


2.4.6.- Create AR Browser View

In order to start using an AR browser you need to do the follow steeps in HelloARlibActivity.java:
First, create an instance of ARbrowserView (ARbrowserView.java) int the onCreate() method of HelloARlibActivity and set it as a content view of the Activity.

public class HelloARlibActivity extends Activity {
 
  /** ARbrowser view instance variable. */
  private ARbrowserView aRbrowserView;
 
  @Override
  /** Called when the activity is first created. */
  public void onCreate(Bundle savedInstanceState) {
 
    super.onCreate(savedInstanceState);
 
    /** Initiation of AR Browser */
 
    /** Create an instance of ARbrowserView object (Valid API_KEY required, In this case is com.arlab API_KEY). */
 
    // To  run in a phone device
    aRbrowserView = 
     new ARbrowserView(this,ARbrowserView.UI_ORIENTATION_ALL,
                       "eKvLkRBMKCKf2BeP3MHi",     
                       ARbrowserView.SCREEN_ORIENTATION_PORTRAIT,false,true);
 
    // If you want to run in a tablet device uncomment this and comment the above sentence
    //aRbrowserView = 
    // new ARbrowserView(this,ARbrowserView.UI_ORIENTATION_ALL,
    //                   "eKvLkRBMKCKf2BeP3MHi",     
    //                   ARbrowserView.SCREEN_ORIENTATION_LANDSCAPE,true,true);    
 
    /** Add view instance to the application content view. */
    setContentView(aRbrowserView.getARviewInstance(), new 
             LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

Valid API_KEY for you own project will be receive by mail after you download the SDK from ARBrowser SDK

Set your current geo location (Could be obtained form GPS reciever Or other sources. Trick: search in google maps your place, click right button and “what's there” option.)

        /** Create GeoPoint with user current Location (Latitude and Longitude can be obtained from GPS or Network provider) */ 
        Location loc = new Location(LocationManager.GPS_PROVIDER);
        loc.setLatitude(32.787996);
        loc.setLongitude(34.959526);      
 
        /** Set user current location (Can be updated at run time) */
        aRbrowserView.setMyCurrentLocation(loc);
 
  } // End of onCreate() method of HelloARlibActivity
 

In order to start the AR view the ResumeArView(); and PauseArView(); calls must be added to the activity life cycle

  @Override
  protected void onResume() {
      super.onResume();
 
      /** Resumes and starts AR view*/
      aRbrowserView.ResumeArView(); 
  }
 
 
  @Override
  protected void onPause() {
      super.onPause();
 
      /** Stops AR view*/
      aRbrowserView.PauseArView(); 
  }  
} // End of HelloARlibActivity

Full sample code is inside ARBrowser SDK downloaded

2.5.- How to Run


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



  • Pick your running device


2.6.- How to Debug


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


2.7.- How to upload to the Google Play