Start a new topic

Problems getting ImageTrackable to work in Xamarin Android

Hey guys,


I have trouble getting image tracking to work on Xamarin Android. This is what I've got so far:


- I got the ArchitectView to display successfully (it shows the watermark and the camera preview)

- I also got the world to load (the html file from the assets). 

- The World.init() in JS seems to execute fine, which means loading TargetCollectionResource and the ImageResource. I think this is successful because I got some paths wrong in the JS the first time and got some errors, which went away after fixing them.


But the target image never seems to get recognized. I tried it with my own images as well as with the first example images (01_ImageTracking_1_ImageOnTarget). I also tried giving an alert("image recognized") on onImageRecognized, but it never fired.


I am grateful for any hints on what I might be doing wrong. I attached the index.html containing the world that I tried using the first example images.


Thanks for your time.

Best regards,

Tim


I am using Xamarin.Wikitude.SDK.JS Version 9.3.1 via NuGet in Xamarin Android (via VS 2019). I tried it on my Samsung Galaxy Tab A (Android 8.1.0) and Samsung S8 (Android 9). 

imageOne.png
(379 KB)
surfer.png
(8.14 KB)
wtc
(90.6 KB)
html
(4.08 KB)

Hi Tim,


What I would recommend for you to start and see/test the different features is to check out the sample app which comes with the SDK download package together with the respective documentation section.


For instance, you will see that there is an example there covering how to work with Image Tracking. You'll first need to define your targets and then create a target collection for it using Javascript code.


Eva

Hi Eva,


Thank you for your time and feedback.


As you may know, there is no SDK download package for Xamarin. It is the NuGet package that gets referenced in my Xamarin Project (which, btw, I did successfully, as you may have read in my post).


As I also described in my post I followed the documentation and the first example and defined a target and created a target collection (as well as using the target / target collection from the first example).


Tim

Hi Tim,


From what I could see in the files you sent, everything is correct and should be loading -> I did test your html in our project with my Pixel 3A XL and it was working fine.


Did you happen to test our sample app and see if it works on your devices? The AR.ImageTracker has an onError callback that you are already implementing, is this callback called at all? That could give us a clue.


I'm also not sure if the lifecycle methods we require are called as we do here in our sample project: https://github.com/Wikitude/wikitude-xamarin-examples.


Hopefully with this info we can tackle your issue down.


Regards,


Aitor.

Hi Aitor,


thank you very much for getting back to this post.


I was finally able to sort out the problems I had. There were two problems in conjunction:


- In my personal world, I made a mistake in the ImageTracker Part:

this.pageOne = new AR.ImageTrackable(this.tracker, "pageOne", {

I forgot to rename "pageOne" to one of my targets. That is why my personal AR world did not trigger tracking images.


- While working with Visual Studio, I realized merely changing the contents of the html/js files in the assets did not update during build. I needed to clear/rebuild the solutino in order to update those. This is why I had trouble using the example programs.


thank you very much for your time and support!


Best regards,

Tim

Login or Signup to post a comment