Start a new topic

Loading World problems

Loading World problems


Hello to all,

I usually use the code above in my Xamarin Android projects to load the ar world and until now all has worked fine.

Today i've update Wikitude to 5.2.0 and also Xamarin Studio Platform, but i'm experiencing this problem: on the device the camera is open witout problems but the ar world is not loaded. I've already check the path of the AR world in my assets folder and it's ok.

public class AR3DModel : Activity, ArchitectView.IArchitectUrlListener
    {

        protected ArchitectView architectView;

        private const string SAMPLE_WORLD_URL = "3d_model/index.html";

        private const string TITLE = "AR3DModel";

        private string wiki_key = Manipulator.getInstance().getArKey();

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            RequestWindowFeature(Android.Views.WindowFeatures.NoTitle);
            //immersive mode
            this.Window.AddFlags(WindowManagerFlags.Fullscreen);
            SetContentView(Resource.Layout.AR);

            //keep screen on
            this.Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);

            architectView = FindViewById<ArchitectView>(Resource.Id.architectView);
            StartupConfiguration startupConfiguration = new StartupConfiguration(wiki_key, StartupConfiguration.Features.Tracking2D);
            int requiredFeatures = StartupConfiguration.Features.Tracking2D;
            if ((ArchitectView.getSupportedFeaturesForDevice(Android.App.Application.Context) & requiredFeatures) == requiredFeatures)
            {
                architectView.OnCreate(startupConfiguration);
            }
            architectView.RegisterUrlListener(this);
        }

        protected override void OnResume()
        {
            base.OnResume();

            if (architectView != null)
                architectView.OnResume();
        }

        protected override void OnPause()
        {
            base.OnPause();

            if (architectView != null)
                architectView.OnPause();
        }

        protected override void OnStop()
        {
            base.OnStop();
        }

        protected override void OnDestroy()
        {
            base.OnDestroy();

            if (architectView != null)
            {
                architectView.OnDestroy();
            }
        }

        public override void OnLowMemory()
        {
            base.OnLowMemory();

            if (architectView != null)
                architectView.OnLowMemory();
        }

        protected override void OnPostCreate(Bundle savedInstanceState)
        {
            base.OnPostCreate(savedInstanceState);

            if (architectView != null)
            {
                architectView.OnPostCreate();

                try
                {
                    architectView.Load(SAMPLE_WORLD_URL);
                }
                catch (System.Exception ex)
                {
                    Log.Error("WIKITUDE_SAMPLE", ex.ToString());
                }
            }
        }

        public bool UrlWasInvoked(string uriString)
        {
            return false;
        }

        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Back)
            {
                Finish();
            }
            return base.OnKeyDown(keyCode, e);
        }

    }

How can i solve?

Thank you.

Hi Luca,
Did you verify that the folder which contains your Architect World is actually packaged into the Android application? I don't know why the Xamarin update should have changed this setting, but this would be my first guess.

You could also implement the ArchitectWorldLoadedListener interface and register it using the 'registerWorldLoadedListener' method. This way you should get a callback in  case the Architect World could be loaded or not.

Best regards,

Andreas

Yes the augmented reality world folder is in the Android assets folder. So it's packaged in the application.

I verified the correct loading of the files using the world listener interface and it's correctly loaded, it call the WorldWasLoaded  method correctly.

But i still don't see anything!

Hi Luca,
Which target image are you scanning? Is it the one that is used in your Architect World?

Best regards,

Andreas

Yes of course!

In addition all the same augmented reality world works properly on iOS

Hi Luca,
How did you verify that the Architect World was loaded?

Can you share a Xamarin project with us so that we can have a look at it as well?

Best regards,

Andreas

I've implemented ArchitectView.IArchitectWorldLoadedListener interface and the methods

public void WorldLoadFailed(int p0, string p1, string p2)
        {
            //do something
        }

        public void WorldWasLoaded(string p0)
        {
            //di something
        }

 

then i've registered the listener

architectView.RegisterWorldLoadedListener(this);

when i launch the activity in my application with the debugger i land in "WorldWasLoaded" method with argument p0 the correct path of my augmented reality folder (in android assets folder)

Hi Luca,
So your Architect World is loaded correctly. This would lead to the conclusion that the Architect World has an issue. I would recommend adding some alerts in JS to track down the line in JS which breaks JS execution.

Best regards,

Andreas

Hi,

I don't think the AR world is not correct, because on xamarin ios all works properly with the same files!

And even if i use the sample augmented reality world provided with SDK i don't see anything.

Hi Luca,
Can you please send us a demo project where we can have a look at the problem? THX!

Best regards,

Andreas

Hi Andreas,

I finally solved the problem, i upgrade Xamarin Studio and all the Android SDK platform tools, then rebuild the project and now works fine.

Thank you for the support!
Login or Signup to post a comment