Does the target system have GPS/GNSS?

Recently one of my colleagues interviewed me in a short video segment on the geolocation sensor in Windows 8, and one of the questions I was asked was whether there was an app that could tell the developer or the user if their system has a GPS or GNSS receiver in it.

The direct answer to this question is "no". This is a side effect of the abstraction in the sensor API which hides the underlying hardware from the software. As I discussed in my blog post "Where did my location data come from?", the location sensor actually looks at multiple sources to attempt to determine the user's position and doesn't pass hardware-specific information up the stack. As a result there's no way to definitively answer the question "is there a GPS in this system?"

As a software developer, however, there is an alternative question that might be more relevant to what you are trying to accomplish. If you are building a precision location app, such as a vehicle dashboard app or a moving map display, what your software really needs to know is whether or not the location data is sufficient to support it. Answering the GPS/GNSS question is interesting, but it's a means to an end and not the end itself.

In my opinion, what you should look at is the following:

  1. The update frequency of the location data. If you are not getting position updates every one or two seconds, then you are probably not dealing with a precision source. This is particularly important for something like vehicle navigation, where a car traveling at highway speeds covers a significant distance in just one second (60 mph = 88 feet per second).
  2. The age of your data. Always double-check the Timestamp property of the Geoposition report. If it's not within a second or two you should consider ignoring it. This is an extension of #1.
  3. The precision of the location data, as estimated by the Accuracy property in the Geocoordinate object. Anything greater than 30 meters is probably not usable for precision navigation (30 meters = roughly 100 feet).

Your software should keep track of both of these values and warn the user if the location data no longer falls within these thresholds. This can be a sign that the user does not have a GPS/GNSS at all, or that they do but have temporarily lost signal reception.



Для получения подробной информации о возможностях оптимизации компилятора обратитесь к нашему Уведомлению об оптимизации.
Возможность комментирования русскоязычного контента была отключена. Узнать подробнее.