question

Scott Yanke avatar image
Scott Yanke asked

LocationManager not returning a location on Kindle Fire HD 7"

In trying to use LocationManager on a Fire HD 7", I get no location returned. I've attempted to use the CoffeeActivity example from the Amazon Mobile SDK, with Eclipse and adding the jar as an external jar. I've also tried several other android samples from google that use LocationManager, but consistently get a null when calling LocationManager.getLastKnownLocation(provider), where provider is the result of locationManager.getBestProvider(new Criteria(), false). Timed updates using something like LocationManager.requestLocationUpdates(provider, TEN_SECONDS, TEN_METERS, listener) get me nowhere also. I know that location finding works on this device, as XXXXXXX app works, along with XXXXXXXX sample. But I have the source to neither one, so I don't know what exactly they are doing. During any location request by them or my own apps, the small icon at the top of the screen does come on to indicate that an app wants to use the location service (which I have enabled). I just don't get anything but null in response to getLastKnownLocation(). My device is a Kindle Fire HD 7", system version 7.2.3_user_2330720. I am not using an emulator, and the battery is fully charged. I'm open to suggestion, both from others experiences and for debugging purposes. Message was edited by: Dixith@Amazon
amazon maps
10 |5000

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

Dixith@Amazon avatar image
Dixith@Amazon answered
Hi, Sorry for delay in getting back to you.Please raise a contact-us( https://developer.amazon.com/help/contactus.html) with your sample application code and captured logs in the logcat while running the application. This would help us to investigate the issue further.
10 |5000

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

Scott Yanke avatar image
Scott Yanke answered
Since so many people have looked at this question, I thought I'd do a quick update. A case was opened with Amazon Development on 1/1/13. They were sent logcat entries along with a Wireshark trace of the network activity the Kindle Fire HD generated while trying to determine its location. The basic log entries that seem to indicate an error are - Fro logcat you'll see LBS: recv complte message 9 bytes LBS_W: L049529W errorCode = unexpectedDataValue and in the Wireshark log you'll see Internet Protocol Version 4, Src: 216.34.140.203 (216.34.140.203), Dst: (suppressed) Transmission Control Protocol, Src Port: http (80), Dst Port: 51121 (51121), Seq: 1, Ack: 102, Len: 9 ... Hypertext Transfer Protocol Data (9 bytes) Data: 000902000030026a80 [Length: 9] The Kindle Fire HD is trying to communicate with the amzlbs.glpals.com server, but they aren't understanding each other. As of 1/12/13 I'm not aware of any solution. Permissions have been verified, as as shown from the network trace, the Kindle Fire HD really is trying to get a location, but failing to understand the network response.
10 |5000

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

Dixith@Amazon avatar image
Dixith@Amazon answered
Hi Scott, Thank you for bringing the issue to our notice. The getLastKnownLocation value is updated only when a location fix is obtained by the provider named "GPS". For short term resolution, the application developers can directly request Location updates from "GPS" providers and after that the Location values will cached correctly in the LastKnownLocation value. We are working on this issue to fix permanently. Regarding sample App, the request location is using GPS provider. Therefore the getLastKnownLocation is returning correct value for the customers. We are able to get Location updates when we request for GPS on a Fire HD device. Hope this information helps you. Message was edited by: Jonathan.D@Amazon
10 |5000

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

Jonathan.D@Amazon avatar image
Jonathan.D@Amazon answered
I wanted to add an update on this thread. This issue has been fixed with the Kindle Fire HD 2.2 update released on 3/27. The getLastKnownLocation value is now updated when a location fix has been obtained, regardless of the location provider. Please note that you may need to call LocationManager.requestLocationUpdates() prior to getLastKnownLocation(); otherwise, the method may still return null since no location fix has been established.
10 |5000

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

Asa Williams avatar image
Asa Williams answered
Does this same issue occur when using the Kindle Fire (2nd Generation) emulator? I am trying to get the coffee test program working, but I keep getting the Toast message saying "Could not obtain location". I've turned on Location Based Services in the emulator, but that has not helped. Any suggestions? Best regards, Tim Crowley
10 |5000

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

Tim@Amazon avatar image
Tim@Amazon answered
Hi Tim, I believe you are encountering a different issue. Instead of true network/gps location updates, the emulator uses an emulated location system that requires coordinates to be sent manually. I tried the coffee sample app and was able to successfully get location updates with "network" as the provider using fake coordinates. A possible issue you may be seeing is that you haven't sent these fake coordinates to the emulator. There are two ways to send the location updates manually. With the emulator running: Through Eclipse: 1. Switch to the "DDMS" perspective 2. Select the "Emulator Control" tab 3. Scroll to "Location Controls" 4. Input GPS coordinates and press send Via the command line: 1. Connect to the emulator console using "telnet localhost " where is the port the emulator is running on. 2. Send location data with the command "geo fix " where and are latitude and longitude values respectively. Once you do this you should see location updates in the sample application.
10 |5000

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

Asa Williams avatar image
Asa Williams answered
Tim@Amazon, you are correct! I didn't realize there was an option to manually send the coordinates, so thank you for pointing that out. Best regards, Tim Crowley
10 |5000

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