Tazaf/ionicitude

AR world launches before device support check.

Closed this issue · 2 comments

Ionicitude is a great solution which will make all the ionic dev's lives simpler.

I have noticed a slight problem which causes the app to crash due to unsupported feature error. The AR world launches before the device check is confirmed to be supported.

Please address this issue.

Thank you.

Tazaf commented

As a complement, it should be noted that this problem occurs only when trying to launch an AR World right when the app starts.

In any case, the commit 49a6862 should solve the problem.

It adds a new method to Ionicitude, the ready() method, which works very much like the $ionicPlatform.ready() method. You just need to encapsulate the code that you want to execute in an anonymous function, passed as the method parameter. This ensures that the code is executed only when Ionicitude has finished initializing itself.

Ionicitude.ready(function() {
    Ionicitude
        .launchAR('myAR')
        .then(function(success) {
            // React to successful launching
        }
        .catch(function(error) {
            // React to unsuccessful launching
        }
});

It also changes a little bit the init() function in that this method doesn't return the service, but act as a promise to which you can react (this was needed for implementing the ready() function). This shouldn't impact your code, though.

To test that this solution is convenient, please download the latest version on the dev branch. If this solves the problem, please report it here so that I can close the issue, update the doc and push these modifications to the master.

Thanks for your support 😉

Fantastic, it’s working great. Thank you so much.