1

I downloaded the MobileFirst Platform Location Services sample project from here:

https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-6-3/advanced-topics/location-services-hybrid-applications/

I can run it successfully in the Mobile Browser Simulator but when I try to run it on an Android Device or in an Android emulator I cannot acquire a position and receive an error 'Error acquiring geolocation (3): Position retrieval timed out'.

The emulator and the device are both running Android SDK Level 21. I am using MobileFirst Platform v7.0 Developer edition installed in Eclipse 4.4.1

Here's the output from Logcat:

http://pastebin.com/xcJXuBtF

  • You say 7.0, yet you are running the 6.3 sample. Try again with the 7.0 sample: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-0/advanced-topics/location-services-hybrid-applications/ – Idan Adar Apr 07 '15 at 12:39
  • Apologies, I downloaded the v7 project from: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-0/advanced-topics/location-services-hybrid-applications/ and I got the same issue – Daniel Fitzgerald Apr 07 '15 at 14:59
  • Okay. Will be investigated. – Idan Adar Apr 08 '15 at 08:58

2 Answers2

1

Edit: Fixed sample was uploaded.

There is a problem in the Location Services sample project and we are currently working to fix it. In the meantime, add the following permissions to your AndroidManifest.xml file:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>  
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

This should fix your problem.

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
Lior Burg
  • 175
  • 6
  • I have managed to get the project working on my device (Nexus 5 running Android 5.1) by adding those permissions to the manifest however I still have not managed to get it working on the emulator. – Daniel Fitzgerald Apr 09 '15 at 10:13
  • @DanielFitzgerald, That's not related to the sample. Try this: http://stackoverflow.com/questions/2279647/how-to-emulate-gps-location-in-the-android-emulator – Idan Adar Apr 09 '15 at 10:45
-1

7 version of the problem is said to have improved, but I continue to have the same problem. There is another interesting situation: I installed an application called GPS Test on my mobile device. This application tests whether you can receive GPS signals from your environment. When I try to get a coordinate from my own application immediately after receiving the signal from the GPS Test application, I can receive coordinates in a few seconds without any problem. Ultimately the standard code works.