question

Amazon Customer avatar image
Amazon Customer asked

Kindle Fire HD 7" - detecting GPS?

My App has to work over a range of devices and one of my in-app payments requires the device to have a GPS. I am detecting the presence of a GPS with: LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); boolean deviceHasGPS = false; if (locationManager.getProvider(LocationManager.GPS_PROVIDER) != null) { deviceHasGPS = true; } Am I right when I say that the Kindle Fire HD 7" doesn't have a GPS, so this should be returning null? If so then it looks like there is a bug in the Fire HD 7", as it is returning a GPS provider...but only getting a Wifi location, which is a LocationManager.NETWORK_PROVIDER.
fire tablet
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Girish@Amazon avatar image
Girish@Amazon answered
Hi S. Fraser, We are following up on this and we will get back to you once we got an update. Thank you.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Matt Matheson avatar image
Matt Matheson answered
I'm not sure, but I think that a call to locationManager.getProvider() returns a bool, so it would not be null, just true or false. Also, does the fire HD have GPS? On this page https://developer.amazon.com/sdk/fire/specifications.html it says that it is Wi-Fi based location services... so maybe it should be LocationManager.NETWORK_PROVIDER, not GPS? Just some thoughts.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Amazon Customer avatar image
Amazon Customer answered
I am not writing for just the Kindle Fire HD, so I have to have generic code which detects the presence of a GPS (and no the Fire HD doesn't have a GPS...). If you check the developer docs, you will see that it doesn't return a boolean, but a LocationProvider: public LocationProvider getProvider(String name) So this is why Amazon are checking, as their code on the Fire HD is incorrectly returning a GPS Provider when it only has a WiFi based network provider...
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Amazon Customer avatar image
Amazon Customer answered
Following on from the response in my other thread on detecting the compass, I have found out that the following works on the Fire HD (and other devices): deviceHasGPS = getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS);
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.