Skip to content
This repository has been archived by the owner on May 29, 2020. It is now read-only.

AR world launches before device support check. #3

Closed
GeoffSeloana opened this issue Jun 11, 2016 · 2 comments
Closed

AR world launches before device support check. #3

GeoffSeloana opened this issue Jun 11, 2016 · 2 comments
Labels

Comments

@GeoffSeloana
Copy link

GeoffSeloana commented Jun 11, 2016

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.

@GeoffSeloana GeoffSeloana changed the title AR world launches before device check. AR world launches before device support check. Jun 11, 2016
@Tazaf Tazaf added the bug label Jun 11, 2016
Tazaf added a commit that referenced this issue Jun 11, 2016
- init() now uses promises. This ensures that all the steps of the init process are executed in the right order (this is needed for the ready() method which rely on the initialized flag)
- The ready() method allows developers to write code that will be executed when Ionicitude is fully initialized
These modifications should solve issue #3
@Tazaf
Copy link
Owner

Tazaf commented Jun 11, 2016

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 😉

@GeoffSeloana
Copy link
Author

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

Tazaf added a commit that referenced this issue Jun 12, 2016
@Tazaf Tazaf closed this as completed Jun 12, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants