Giter Site home page Giter Site logo

Comments (14)

jesseruder avatar jesseruder commented on May 2, 2024 4

Ok we figured out how to reproduce this. Will fix it in the next release.

from expo.

jesseruder avatar jesseruder commented on May 2, 2024 2

I think that's the same error @alexprice91. We're doing a release this week and we'll see if that fixes these issues.

from expo.

ChenLi0830 avatar ChenLi0830 commented on May 2, 2024 1

@jesseruder It works for me in iOS and Android > 6. As for Android < 6, it works fine if the location is turned on. However, if the location on the phone is turned off, the app would keep waiting when running await Location.getCurrentPositionAsync({enableHighAccuracy: true}) and no error is triggered. Not sure if it is the intended behavior.

We ended up setting a timeout for this situation as shown below, but it would be nice if an error would be triggered with the message saying the phone's location is not available.

      await Promise.race([
          Location.getCurrentPositionAsync({enableHighAccuracy: true}),
          // 2s Timeout for Android phones system version < 6
          new Promise((resolve, reject) => setTimeout(()=>reject(new Error('timeout')), 2000)),
      ])
          .then(result => {
            console.log("location", location);
            location = result
          })
          .catch(error => {
            console.log("get location timed out", error);
          });

from expo.

jesseruder avatar jesseruder commented on May 2, 2024

@nikki93

from expo.

andrewrd avatar andrewrd commented on May 2, 2024

I've tried watchPositionAsync() too with the same code and it doesn't seem to be working either.

EDIT: I solved this by placing the function as an async function within the component itself

  async _getPosition() {
    const {Location, Permissions} = Exponent;
    const {status} = await Permissions.askAsync(Permissions.LOCATION);
    if (status === 'granted') {
      Location.getCurrentPositionAsync({enableHighAccuracy: true}).then((position) => {
        this.setState({lon: position.coords.longitude, lat: position.coords.latitude});
        this.callAPI();
        }).catch((e) => {
         // this one is firing the error instantly
          alert(e + ' Please make sure your location (GPS) is turned on.');
        });

    } else {
      throw new Error('Location permission not granted');
    }
  }

This is how I am calling it.

componentDidMount() {
    this._getPosition();
}

from expo.

jesseruder avatar jesseruder commented on May 2, 2024

Thanks for the information. We're heard multiple reports of this but don't hit it on our devices. Will try your code.

from expo.

alexprice1 avatar alexprice1 commented on May 2, 2024

@jesseruder I am getting the error:

{"framesToPop":1,"code":"E_TIMEOUT"}

Is this related?

from expo.

jesseruder avatar jesseruder commented on May 2, 2024

Should be fixed. Can you try it out and let me know?

from expo.

nikki93 avatar nikki93 commented on May 2, 2024

This should be fixed in SDK 18, will close once released and confirmed by users.

from expo.

nikki93 avatar nikki93 commented on May 2, 2024

Released! @ciokan @andrewrd @alexprice91 @ChenLi0830 Let me know if this is still happening for you in SDK 18.

from expo.

atinder avatar atinder commented on May 2, 2024

still happening on sdk 18.0.4

from expo.

skbogner avatar skbogner commented on May 2, 2024

Same happens to me.
Android 5.1.1
expo 18.0.9

Edit:
It happens when the location in android settings is set to GPS only, but it works if it's set to use both wi-fi, gps, ...

from expo.

jesusmgg avatar jesusmgg commented on May 2, 2024

Reporting same error, Android 6.0.0, expo 1.18.4, xde 19
https://exp-xde-diagnostics.s3.amazonaws.com/jesusmg-b629d5cc-72ed-4ea3-86a2-0459e06f9c90.tar.gz

from expo.

san17ap93 avatar san17ap93 commented on May 2, 2024

Same happens to me.
Android 5.1.1
expo 18.0.9

Edit:
It happens when the location in android settings is set to GPS only, but it works if it's set to use both wi-fi, gps, ...

same here!

from expo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.