Following document is dedicated for the following: LifeCycle Management of MAXST AR and Start/Stop of Camera & IMU Sensor for Android Device


LifeCycle Management of MAXST AR

Operate tracker from the selected tutorial after combining MaxstAR to LifeCycle of the Activity that you wish to operate.

※ Correct license key must be entered to Maxst.init() function to properly activate.

Refer to API Reference for each functions' guideline.

※ When the incorrect license key is entered, Invalid Signature will appear as watermark, and target tracking and AR contents rendering will fail to operate.


@Override
protected void onCreate(Bundle savedInstanceState) {
    MaxstAR.init(getApplicationContext(), "your license key");
    MaxstAR.setScreenOrientation(getResources().getConfiguration().orientation);
 }

@Override
protected void onResume() {
    MaxstAR.onResume()
}

@Override
protected void onResume() {
    MaxstAR.onPause()
}

@Override
protected void onDestroy() {
    MaxstAR.deinit()
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
    MaxstAR.setScreenOrientation(newConfig.orientation);
}

Add onSurfaceChanged function of SurfaceView Renderer as follows


@Override
public void onSurfaceChanged(GL10 unused, int width, int height) {
    MaxstAR.onSurfaceChanged(width, height);
}


Start/Stop Camera

Start/Stop Camera from Activity


@Override
protected void onResume() {
    ResultCode resultCode = ResultCode.Success;
    resultCode = CameraDevice.getInstance().start(0, 1280, 720);
}

@Override
protected void onPause() {
    CameraDevice.getInstance().stop();
}


Start/Stop IMU Sensor

Start/Stop IMU Sensor from Activity

※In case of Instant Tracker, IMU Sensor data is required.


@Override
protected void onResume() {
    SensorDevice.getInstance().start();
}

@Override
protected void onPause() {
   SensorDevice.getInstance().stop();
}