List
Problem when using both qr code tracker and object tracker
Posted Date: 2021-04-14 13:04     Edited Date: 2021-04-27 6:08     Writer: inactive

1. SDK Version: 5.0.4
2. Development Environment: Native Android
3. Tracker/Scanner: QR Code Tracker + Object Tracker
4. License Type: Pro-Subscription
5. Target Device(Optional): Android Tablet

Hello everyone,

I have a problem when trying to use both the qr code tracker and the object tracker on Native Android. I have two seperate fragments on a main activity. So I use the qr code tracker on the one fragment (fragment1) which works as it should, but when i go to the other fragment (fragment2) with the object tracker I get an error from the Android Logcat as shown in the picture bellow.

 

The camera stops working with code 2. I dont know the reason, but I suspect that the glSurfaceView used to show the view on both fragments is the problem. So, for each fragment I create a new GLSurfaceView that I initialize as I should:

glSurfaceView = (GLSurfaceView)fragmentActivity.findViewById(R.id.gl_surface_view);
glSurfaceView.setEGLContextClientVersion(2);
glSurfaceView.setRenderer(qrCodeTargetRenderer);

 

and

 

glSurfaceView = (GLSurfaceView) fragmentActivity.findViewById(R.id.gl_surface_view_object_tracker);
glSurfaceView.setEGLContextClientVersion(2);
glSurfaceView.setRenderer(renderer);

 

Can anyone help? Thanks in advance,

Nektarios Patlakas

Posted Date: 2021-04-15 5:40     Edited Date: 2021-04-15 5:40     Writer: sjkim

Thank you for your interest in MAXST AR SDK.

 

Sorry, but with the current MAXST AR SDK, you can't use more than one AR Tracker at the same time.

 

However, stop one AR Tracker (com.maxst.ar.TrackerManager.stopTracker()),

if you start another AR Tracker (com.maxst.ar.TrackerManager.startTracker (int trackerType)), other AR Trackers will be able to operate.

 

 

Thank you


 
Best regards,

Francisco

MAXST Support Team

Posted Date: 2021-04-15 7:32     Edited Date: 2021-04-15 7:32     Writer: inactive

Hello,

I have followed the examples from the documentation so in every fragment (fragment1 and fragment2) :

@Override
public void onPause() {
    super.onPause();

    glSurfaceView.onPause();
    TrackerManager.getInstance().stopTracker();
    CameraDevice.getInstance().stop();
    SensorDevice.getInstance().stop();
    MaxstAR.onPause();

}

@Override
public void onDestroy() {
    super.onDestroy();

    TrackerManager.getInstance().destroyTracker();
    MaxstAR.deinit();
}

 

and I use the StartTracker function in the "onResume()"  function.

Thank you very much for your time,

Nektarios

Posted Date: 2021-04-19 2:45     Edited Date: 2021-04-19 2:45     Writer: sjkim

This bug is you didn't reset surface

 

So, To fix it, you should reset the surface in callback glSurfaceView.

When resume surface in callback glSurfaceView, set it to call start to play.

 

 

Best regards,

Francisco

MAXST Support Team

Posted Date: 2021-04-20 10:31     Edited Date: 2021-04-20 10:31     Writer: inactive

Hello, I don't understand the solution, so if you could please explain to me what do you mean. In the onResume function, to call glSurfaceView.start to play? I don't think that glSurfaceView has a start function.

Thank you very much for your time,

Nektarios

Posted Date: 2021-04-21 9:11     Edited Date: 2021-04-21 9:13     Writer: sjkim

Each fragment must be destroyed to initialize the surface.

Add the code for Destroy to all fragments.


protected void onDestroy()

{

   super.onDestroy();

   TrackerManager.getInstance().destroyTracker();

   MaxstAR.deinit();

}

 

Best regards,

Francisco

MAXST Support Team

Posted Date: 2021-04-26 14:30     Edited Date: 2021-04-26 14:30     Writer: inactive

This logic is not easily compatible with the Navigation Component of Android OS. Do you have any alternatives?

Thank you for your time,

Nektarios

Posted Date: 2021-04-27 6:08     Edited Date: 2021-04-27 6:08     Writer: sjkim

Sorry, We don't officialy support to the navigation api of Android.

Therefore, the MAXST AR SDK and the navigation api can't be used at the same time.

 

 

Best regards,

Francisco

MAXST Support Team