How can I indicate the GPS status/fix

Continued from: https://forums.garmin.com/developer/connect-iq/f/discussion/399601/position-altitude-activity-info-altitude

I made some debugging, because I'd like to add some GPS indicator to the app. Something similar to the colorful circle or line at the beginning of an activity, that indicates if the GPS is ready or the user should wait a few more seconds before starting to record the activity. So I added some more logs:

10:51:39 onStart
10:51:40 timerStart
10:51:49 onPosition: ac: 4, al: 28.794516, h: 0.722252, p: N 41.761165°E 024.768223°, s: 0.000000, w: 10:51:49, ai.al: 13.034976
10:51:50 onPosition: ac: 4, al: 42.072090, h: 0.722252, p: N 41.761095°E 024.768148°, s: 0.000000, w: 10:51:50, ai.al: 26.321882

What I am interested in is how can I use Position.Info.accuracy ("ac" above). When I start the app I also start the GPS sensor. On the screen I start to display the elevation from ActivityInfo.altitude ("ai.al") and what I saw was "--" for a few seconds, and then 13 and then 26 (close enough to the actual ~22 where I was standing). I thought that I'll see the accuracy increase in the 1st seconds from 0 or 1 (when I saw "--") and then to 2 (when I saw 13) and then to 3 or 4 (when I saw 26)

Especially because of the 2 "jumps" (between -- to 14 and from 13 to 26) I was hoping that the accuracy will be increasing and that I could use that to indicate red/orange/yellow/green, but apparently not Disappointed

If someone knows how to acquire the data that can be used for such GPS status/fix indicatior in an app, please share your code!

  • > differentiate non existant GPS (if there's such device at all)

    If such a Garmin device exists, and your apps rely on having a good GPS fix (i.e. they're not intended to be used indoors), it seems that the best course of action would be to simply not release your apps for that device at all.

    However, I don't think there are any non-GPS Garmins which also support Connect IQ. Garmin vivofit fitness tracker bands lack GPS (and HR), but they also lack support for Connect IQ

    If non-GPS Garmins which support CIQ did exist, I imagine that the symbols for various GPS-related functions, fields and constants might be missing for that device (meaning you could use has checks to detect the existence of GPS functionality), but it's kind of academic at this point.

    > in case of the app I also would like to know this "in advance" (before the session is started) to be indicate if the app (watch) is ready or it needs some more time to get a GPS fix before the user can start the activity.

    This can be accomplished by having the user manually start the session by pressing a button, and displaying a (more or less) binary GPS indicator before the session starts. e.g. Red GPS text for QUALITY/UNAVAILABLE/QUALITY_LAST_KNOWN and green text for QUALITY_GOOD. As discussed, your code can handle the other states, but the user will probably never see them.

    If you want to nudge your user towards taking steps to get a good fix (like enabling GPS and going outside), you could also more descriptive text like "Waiting for GPS..." (any state other than QUALITY_GOOD) and "GPS Ready" (QUALITY_GOOD), which will help with the following situation you want to handle:

    > disabled GPS (in case of the DF)

    If your user is using your CIQ data field, they already have a native GPS indicator which indicates whether GPS is disabled or not. What is your field going to do differently if GPS is disabled as opposed to not having a good fix? Tell the user to turn on GPS? At the end of the day, the user needs to know that they need a good GPS fix, which can be (somewhat) conveyed by displaying "Waiting for GPS..." / "GPS Ready".

    I understand the desire to have a more granular GPS indicator in your device app (which indicates the progress of obtaining a GPS fix, similar to the native indicator), but I don't think that's gonna happen.

    If your apps do support indoor operation, and you want to avoid giving the user the impression that GPS is required indoors, then:

    - for the device app, you could prompt the user to select Indoor or Outdoor when the app opens, similar to what Garmin does for sports like basketball and skating

    - for the data field, you could have 2 different versions (indoor and outdoor). If you don't want to do that (which would be understandable), you could just display the GPS indicator anyway, you could have a GPS indicator which only appears when the GPS quality is good (not a great solution, I know), or you could simply not display a GPS indicator at all. After all, if the purpose of the GPS indicator is to indicate to the user that they shouldn't start the activity before they have good GPS, then the native GPS indicator already accomplishes that. If they regularly use native outdoor activities, they are most likely used to waiting for a good fix before starting an activity.

  • I'd like to have a GPS indicator icon on the screen, and preferably I'd like to be able to display a different icon when the GPS is disabled and when it's enabled but has no fix yet: GPS disabled / GPS has no fix or bad quality / GPS good quality.

    Most of the recommendations are kind of workarounds about the "assumption" (of mine) or "fact"? that there's no way to differentiate in a DF if the GPS is disabled or has bad reception. Of course in my own app I'll have a setting for enabling/disabling the GPS, so there I'll know.

  • I'd like to have a GPS indicator icon on the screen, and preferably I'd like to be able to display a different icon when the GPS is disabled and when it's enabled but has no fix yet: GPS disabled / GPS has no fix or bad quality / GPS good quality.

    I understand that, but I don’t think it’s possible. 

    Most of the recommendations are kind of workarounds about the "assumption" (of mine) or "fact"? that there's no way to differentiate in a DF if the GPS is disabled or has bad reception

    That’s correct, as nobody who’s posted in this thread knows of a way to determine whether GPS is disabled or not via the CIQ API, except when your device app “controls” the GPS state. (inb4 the app doesn’t directly control the GPS state, it just so happens that GPS is normally turned off by default, and enabling location events happens to cause the GPS to turn on.)

    In fact, all of us in this thread assume there is no way to determine whether GPS is enabled or disabled.

    We can post all the bug reports and feature requests we want (I sure do), but at some point we also have to work with Connect IQ as it is, not as we would like it to be, especially when it comes to functionality that simply does not exist (as opposed to broken functionality.)

    You haven’t explained how it helps a user of your data field for the field itself to distinguish between disabled GPS and enabled GPS without a good fix. The user already has a way to determine that, if the activity has not started yet. If the user has started the activity, your field can still indicate the lack of a solid GPS fix.

  • In fact, all of us in this thread assume there is no way to determine whether GPS is enabled or disabled.

    I tend to believe it too now. At the beginning I thought that QUALITY_NOT_AVAILABLE might mean that the GPS is disabled. 

  • From my tests: QUALITY_NOT_AVAILABLE means gps disabled, in other cases you can see good or bad strange values