2

The GDK developer guide states:

Local providers obtain location data from the Glass hardware such as GPS_PROVIDER and NETWORK_PROVIDER.

However this doesn't seem to be the case. I tried logging all available providers with:

Log.d("LocationDebug", mLocationManager.getAllProviders().toString());

The result is:

[remote_gps, remote_network, network, passive]

So no local GPS. If I try anyway with the following code:

mLocationManager.requestSingleUpdate(LocationManager.GPS_PROVIDER, this, null);

The app crashes and the following gets logged:

java.lang.IllegalArgumentException: provider=gps

hichris123
  • 10,145
  • 15
  • 56
  • 70
user1000039
  • 785
  • 1
  • 7
  • 19
  • Do you need to add any permissions to your app? In your manifest? – hichris123 Nov 23 '13 at 18:51
  • My manifest file has android.permission.ACCESS_COARSE_LOCATION, android.permission.ACCESS_FINE_LOCATION, and android.permission.INTERNET – user1000039 Nov 23 '13 at 19:17
  • Are you connected to MyGlass when doing this? – hichris123 Nov 23 '13 at 19:33
  • Need to be connected to smartphone/MyGlass for location, see: http://stackoverflow.com/questions/18343373/location-on-google-glass – Morrison Chang Nov 23 '13 at 19:33
  • I don't have MyGlass (I've got an iPhone). Although the quote from the developer guide implies that you can use the GPS chip directly on glass without getting remote data from an android device – user1000039 Nov 23 '13 at 19:34
  • Yeah, I was wondering if maybe being connected to MyGlass would give you different options. I'll try this a little later on my Glass and see if I get the same results. – hichris123 Nov 23 '13 at 19:35
  • Well somehow the navigation app handles local GPS without a MyGlass connection (with the GPS_ENABLE_LOCAL labs feature enabled). However having that enabled still doesn't change the results in my app – user1000039 Nov 23 '13 at 19:41
  • The documentation has been updated to clarify the best practices for location on Glass. Currently, Glass gets GPS information from remote providers through MyGlass, and because the list of location providers is dynamic, you should use the Criteria-based approach or the all-providers approach. – Tony Allevato Nov 26 '13 at 16:43

1 Answers1

0

As described in the location and sensors developer guide, you should avoid referring to specific location providers, such as GPS_PROVIDER by name. Instead, use a Criteria-based approach or iterate over all location providers to ensure that you include the "remote" providers that retrieve locations from a Bluetooth tethered device running the MyGlass companion app. This will get you the most reliable location information.

Tony Allevato
  • 6,429
  • 1
  • 29
  • 34