Classes and Custom Behavior

This section describes important classes and their methods that can be overridden or called for advanced behavior and implementation. Please also refer to javadocs that are included with the library project for more details.

JunaioARViewActivity

This is base activity for junaio AR view. It inherits JunaioViewActivity. By default, it only shows camera preview and AR contents.

Callback methods

For GUI overlay and custom behavior, you need to override following callback methods:

onStart

This is Activity.onStart callback. You need to override this if you want to add any custom GUI overlay. To add already inflated/created views, call addContentView method after super.onStart().

onOrientationSensorChanged

This is called when orientation sensor value is changed. It can be used to update GUI orientation if needed. Note that rotation of the radar view is automatically handled.

onScreenshot

This is called when screen shot is ready. The screen shot will be passed as Bitmap object. Note that the function is called on OpenGL render thread, if you need any intensive processing, do it in another thread. Furthermore, the Bitmap object must be destroyed after usage by calling recycle method.

Other methods

You can call following methods for the desired functionality:

takeScreenshot

Call this method to take a screen shot. The screen shot will be returned in onScreenshot callback.

JunaioViewActivity

This is abstract class that represents a junaio view. It can be extended to implement a custom view.

Callback methods

invalidateAll

This is called when data is invalidated after a network request. The respective view should be updated. Make sure to call super.invalideAll to clear the flags.

updateGUI

This is called when the channel is changed. Any GUI that is dependent on channel contents or type should be updated in this callback, e.g. hide or show radar, channel icon etc.

showProgress

This is called as soon as background processing such as network activity is started or stopped. The application should display or hide progress in this callback.

showToast

This is called to display a toast message usually after an error. You can override this to change the behavior.

Other Methods

setChannel

Set the channel to view. This method takes junaio channel ID. The channel details are first downloaded and when ready, updateGUI callback is invoked so that application can update its GUI based on new channel. Once channel details are downloaded, it will automatically proceed to download its content.

In case of failure, the error messages will be automatically shown.

getChannel

Get current channel object. It will return MetaioWorldChannel object which contains channel information such as name, author, icon, thumbnail and type etc.

JunaioPlugin

This class holds static data structures and methods for the plugin. The following members are important:

startJunaio

This method initialized plugin and it must be called once. Please refer to SplashActivity in the template project on how to use this method and handle error conditions.

setAuthentication

Set client authentication by providing a username and a password. If the application is using a non-public channel, this must be called for channel to be viewed.

dataManager

The data manager is responsible for downloading and holding contents from junaio server. The application should not call its methods directly, however for a custom view, the following methods can be used:

getPOIs

This returns a list currently downloaded POIs.

selectPOI

Call this to select a POI by its ID. The selected POI can be later retrieved by calling getSelectedPOI. This is useful method if POI details are to be displayed in another Activity.

getSelectedPOI

It returns POI that is previously selected using selectPOI call.

Settings

This class provides advanced settings that can be mainly used for debugging purposes. The following members can be used:

enableErrorLog

If this boolean flag is true, the plugin will output all the error messages to LogCat that can be used for debugging purpose. This flag should not be enabled for release.

enableCache

The junaio plugin caches all the assets for a channel by default. This behavior can be changed by setting this flag to false.

overrideLocation

The junaio plugin always use location from GPS sensor on the device. However, you can manually set any location to override GPS sensor. First you need to create the object and then set its value, e.g.

JunaioPlugin.Settings.<em>overrideLocation</em> = *new* LLACoordinate();
JunaioPlugin.Settings.<em>overrideLocation</em>.setLatitude(48.160797);
JunaioPlugin.Settings.<em>overrideLocation</em>.setLongitude(11.551244);

Setting this object to null will enable GPS sensor.

cameraWidth and cameraHeight

These members can be used to change default camera preview resolution. Note that this defines requested resolution only; the actual resolution will be different depending on device hardware specification. The junaio plugin will automatically select the nearest resolution. The default resolution is 320x240.

The resolution must be changed with care, because it will affect tracking quality as well as rendering rate (FPS).

reset

Call this method to reset all the settings to their defaults.

1.3 MetaioWorldChannel

This class holds junaio channel information. The names of the fields are self-explanatory and can be retrieved by calling get methods.

1.4 MetaioWorldPOI

This class holds junaio POI information. The names of the fields are self-explanatory and can be retrieved by calling get methods.

Topic revision: r1 - 2011-10-18 - 11:25:18 - SupportMetaio
 
This site is powered by the TWiki collaboration platformCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback