Start a new topic

Potential bug in InstantTracker Class (Android Javascript SDK)

Hello

According to the Wikitude SDK API Reference here
". Should there be multiple Trackers used in the ARchitect file, the following logic applies to specify the currently active Tracker:

When a new Tracker is created, it is automatically set to the active one, unless it was created with enabled set to false.

I tried to test this with the following code:   

AR.logger.activateDebugMode();
// a Tracker referencing a target collection
var resource1 = new AR.TargetCollectionResource("assets/0.wto");
var tracker1 = new AR.InstantTracker(resource1 , {
  onDisabled : function(){
    //tracker has been disabled by the system
  }
});
var enabled = tracker1.enabled; // should be true
AR.logger.debug("1. "+enabled);
// a second tracker, which will cause tracker1 to be disabled
var resource2 = new AR.TargetCollectionResource("assets/1.wto");
var tracker2 = new AR.InstantTracker(resource2);

enabled = tracker1.enabled; //should be false
AR.logger.debug("2. "+enabled);
enabled = tracker2.enabled; //should be true
AR.logger.debug("3. "+enabled);

  The output I get is:
1. true
2. true
3. true

While  the expected is:
1. true
2. false
3. true

Am I getting something wrong or is this a bug? 

Thank you.


Hi,



an AR.InstantTracker does not take an AR.TargetCollectionResource as in input. Is this an error in the snippet you posted, or is this really the code you are running? 



- Daniel

Hi Daniel,
Thanks for replying.

you're right that's not the code I intended to post, This is the code I used:   

AR.logger.activateDebugMode();

tracker1 = new AR.InstantTracker();

enabled = tracker1.enabled; // should be true
AR.logger.debug("1. "+enabled);

tracker2 = new AR.InstantTracker();

enabled = tracker1.enabled; //should be false
AR.logger.debug("2. "+enabled);
enabled = tracker2.enabled; //should be true
AR.logger.debug("3. "+enabled);

   

I tested multiple combinations with and without instant trackables, loadExistingInstantTarget... but I always get the same output.

Good morning,



this indeed strokes me as a bug if you get true for all of the logs in this snippet. The enabled property is one thing, but how does the tracking behave? Do the trackers behave according to what is reported by the enabled flag? Or does the tracking behaviour switch over to tracker2 once it has been created? I'm thinking this might only be a bug of the property, which would not be as critical as the tracking being done by the incorrect tracker.



- Daniel


Login or Signup to post a comment