22

I'm using Android O Developer preview 4 - API 26

Device - Google Pixel XL

enter image description here

And seems like the new features such as:

  • hasSpeedAccuracy() always returns false
  • getSpeedAccuracyMetersPerSecond() always returns 0.0
  • getBearingAccuracyDegrees() always returns 0.0

for both fused and gps location providers. I've tried it while was moving in the car. So I have speed and bearingthemselves but don't their accuracy.

Am I missing something?

See docs here

Thanks!

InsFi
  • 1,298
  • 3
  • 14
  • 29
  • Are you using a background service? – Pedro Varela Aug 08 '17 at 00:15
  • 2
    This might sound unbelievable, but it happens. API level X translates as, 'the method is implemented', but does not imply it's correctly implemented. I am saying this because I am certain, that QCM does not provide full stack support in some of their platforms regarding GPS implementation. As in, the method exists, but it just does not provide the correct values. True story. (Although I am surprised this happens in Pixel XL) – Olaia Aug 08 '17 at 10:02
  • @PedroVarela No, I'm not using a background service. At least I think so. I grabbed an example from official docs. See [here](https://developer.android.com/training/location/change-location-settings.html) – InsFi Aug 09 '17 at 09:18

3 Answers3

3

these method will not work depending on the API level of the device you are running/debugging on.

Can you check what API level your Google Pixel XL is?

el Punch
  • 210
  • 2
  • 6
2

Check what value you are getting when you try to use getSpeedAccuracyMetersPerSecond()

Go through the definition of getSpeedAccuracyMetersPerSecond(). If that is going to return you 0.0, then you will keep getting false irrespective of what location provider you use

Arun Shankar
  • 2,295
  • 16
  • 20
  • 2
    I have 0.0 indeed. That's why I asked this question. Which location provider should I use to have proper speed accuracy ? Or what should I do to have it worked ? – InsFi Jul 25 '17 at 11:53
0

@InsFi, Check this sample code I wrote. I had some trouble before.

Android: "Calling thread must be a prepared Looper thread" error when I use AsyncTask

I implemented the LocationCallback, read the whole post so you get an idea.

I have a pixel phone and it works well.

Pedro Varela
  • 2,296
  • 1
  • 26
  • 32