Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android O API 26. Newly added Location methods don't work as needed

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!

like image 777
InsFi Avatar asked Jul 20 '17 13:07

InsFi


People also ask

How do I access location on Android?

Open your phone's Settings app. Under "Personal," tap Location access. At the top of the screen, turn Access to my location on or off.

What does it mean by Android API level and why do we need it?

What is API Level? API Level is an integer value that uniquely identifies the framework API revision offered by a version of the Android platform. The Android platform provides a framework API that applications can use to interact with the underlying Android system.

What is Android location API?

The location APIs available in Google Play services facilitate adding location awareness to your app with automated location tracking, wrong-side-of-the-street detection, geofencing, and activity recognition.


2 Answers

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?

like image 137
el Punch Avatar answered Oct 15 '22 11:10

el Punch


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

like image 33
Arun Shankar Avatar answered Oct 15 '22 10:10

Arun Shankar