Location.startLocationUpdatesAsync returns [Unhandled promise rejection: Error: java.lang.Double cannot be cast to java.lang.Float] error

I’m trying to implement background task on my application and it’s working well on iOS device but with Android,it returns [Unhandled promise rejection: Error: java.lang.Double cannot be cast to java.lang.Float] error.
Code is quite simple like below and don’t know how to handle this error.

  _startBackgroundTask = async () => {
    await Location.startLocationUpdatesAsync(LOCATION_TASK, {
      accuracy: Location.Accuracy.High,
      distanceInterval: 3
    })
  }
[Unhandled promise rejection: Error: java.lang.Double cannot be cast to java.lang.Float]
- node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:146:31 in createErrorFromErrorData
- node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:95:30 in <unknown>
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:397:12 in MessageQueue.__invokeCallback
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:127:11 in <unknown>
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:297:8 in MessageQueue.__guard
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:126:9 in MessageQueue.invokeCallbackAndReturnFlushedQueue
* http://192.168.XXX.XX:19001/debugger-ui/debuggerWorker.js:72:58 in <unknown>

Hey @chansuke!

Could you link a snack with a more complete version of your code? That way I can run it on my side and try to recreate the error / go through the code.

Are you running this application on a simulator or your own device? Also, please let me know what SDK version you are using

Thanks!

@charliecruzan Thank you for your reply.I run on a several devices and the error occurs in Zenphone ASUS_Z00AD(Android6.1).It’s working on an another devices.

hmm.I tried to reproduce the error in expo snack but I couldn’t.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.