Android / GPS

Some Mobile Software Product GPS Best Practices

Here are some GPS best practices I’ve put together for Android.  It can apply to other phones as well.

GPS Failures

My uncle, Gary Barett, is a PhD in electrical engineering and a GPS engineer as well.  He’s a really sharp guy and available for hire, BTW (if you need a GPS expert let me know – I’ll hook you up).  During his career, he spent a lot of time working on GPS when it was relatively new.  Gary has, in his career, spoken with one of the few people at the DoD who really understands GPS. So, when it comes to GPS he really knows his stuff.  Here’s what I learned from Gary about some common reasons why GPS fails.

1. Antenna Movement.

GPS antennas work on phase shifting (look it up if you don’t know).  GPS transceivers and their antennae are very sensitive to movement.  So, if your GPS unit is on a boat, a buoy, a bouncing car, or you wave around your GPS enabled phone like an excited Italian trying to give driving directions, you can loose your signal.  Loose your signal enough times, and the transceiver will turn off for long periods of time or do a cold reboot.  You know you have this problem if your GPS signal suddenly disappears and the GPS antenna won’t latch on again for long periods of time (or sometimes until your phone gets rebooted).

2. GPS Dead Spots Always In the Same Place (Phase Shift Issues).

Most people know that a GPS transceiver needs at least four satellites to get any kind of a fix.  But few people know that there are actually GPS dead spots that remain in the same place on the earth’s surface.  Intuitively, we know they’re there in places where there’s no line of sight (like an urban canyon).  But, few, if any of us are ever told that even on flat ground with a clear line of sight there can be dead spots.

Here’s why.  In order for your GPS transceiver to detect a satellite, the signal from the given satellite must be strong enough for the transceiver to pick it out of all the background noise.  The way the GPS transceiver detects a signal however, is through detecting phase shifts in the satellite signals.  Too many satellite signals canceling out or distorting or too similar to each other will make it hard for the transceiver to know what satellite is what.  So, the transceiver just gives up as if there were no satellites were there.

But, you might ask, if the earth is rotating and the satellites are always moving, how come the dead spots never change?  Simple.  The GPS satellites, even though they are moving, always follow the same path in space.  There are places below the constellation where the satellites always converge in just the right spot to cause enough of a phase shift interference in the same spot.

This explanation was the answer to a long standing dilemma I had at my previous company, Root Wireless.  During testing, we showed that cell phones always just seemed to die in a particular spot during drive tests, and then not pick up a GPS signal for many minutes (sometimes 20-30).  What happened most likely, it seems, is a particular geographic location always was washed in GPS signals that overlapped just enough to cause phase shift problems.  This one spot confused the cell phone transceivers on different cell phones.  The transceivers thought the satellites were missing, and after trying again and a gain, they just gave up.

You know you have this problem when you drive the same rout many times and your GPS always looses it’s fix in the same spot, regardless of day, weather, or other factors.

3. Satellite Maintenance.

Satellites need to undergo routine maintenance.  It’s common for a satellite to be shut off during a maintenance cycle.  This can cause you to spontaneously loose one or more satellites.  A suddenly disappearing satellite can confuse your GPS transceiver.

4. It Could Be the Russians.

Probably the coolest explanation I heard from Gary had to do with espionage and The Cold War.  When the Russians built their GPS constellation, they did two things. They put up their own satellites, but they also tried to use our own satellites against us.  The idea, apparently, was that the GPS signals from the Russian satellites would somehow overlap our own signal (“piggyback”). This apparently served two purposes.  First, it allowed the Russians to use the freely available signal to guide their own ICMBs and other weapons.  After all, who needs three meter accuracy to target a city with a nuclear missile?  Anything within a few thousand feet will do nicely thank-you-very-much.  Second, it gave the Russians the opportunity to confuse our own GPS sensing equipment by spoofing our own GPS signals.  No better way to cause your GPS transceiver to go haywire.

Some GPS Best Practices

Here’s some additional information about some GPS best practices you might find useful.  Whether your a developer, product designer, or you just simply have your head in the sky about what GPS  can and cannot do, this may help.

1. Treat GPS Transceivers as Phantom Users of Your Applications

GPS transceivers live to feed data into your application. If you treat the GPS service as if it were another user competing for input time and screen space on your cell phone, you’ll write software that co-exists with GPS in peaceful ways.

2. If I’ve Told You Once ….

GPS is a line of sight technology. It doesn’t work indoors or in canyons. If you get GPS data when you’re indoors, it’s simply because your cell phone got the location from another source (e.g. a network server).  There’s no sense in trying to get the GPS to put out if you don’t get a solution.

3. Cell Phones Aren’t Personal Computers or Servers or Dedicated GPS units.

Using the GPS requires a thread.  Cell phones don’t usually handle multi-threading well, even though the capability is there to do background processing.  Be overt about your GPS usage in the user interface.  Design your GPS application around a single thread or design well-thought out pre-emption.

4. Decide Early on What Your Performance Envelope Is.

Decide how accurate you need a fix, how often you need the fix, and what conditions you need the fix in.  That’s your basic GPS “performance envelope.”  If your product designers want to use GPS outside that envelope, then they need to rethink their requirements.

5. If It Walks Like a Duck, It’s Ain’t Always a Duck.

GPS readings from the network are not the same as solutions from an antenna.  Know and talk about the differences.

6. GPS Chipsets and Transceivers In Cell Phones Are Flakey

… even in phones of the same model.  One cell phone may work better than another.  So, don’t “rely” GPS working too much.  They’re either working or not. And, expect them to magically go offline at any time. As the FAA can tell you, GPS receivers on airplanes are much different than the ones in your phone.

7. Use GPS as Infrequently as Possible.

The less your application uses GPS, the happier your user will be.  Stick to a bare minimum.

8. Avoid Spying and Spy-Like Behavior.

Cell phone GPS is not a tracking tool like the one Batman uses to tail bad guys.  Off-shipping GPS data from the cell phone should be avoided if possible.  Nobody likes a peeping Ron.

9. Keep GPS In the User Command and UI Loop.

A quick peak at your handy thesaurus will tell you how you should make GPS appear on your app.  Make it

accessible, barefaced, bright, clear, clear as a bell, conclusive, conspicuous, discernible, distinct, distinguishable, evident, explicit, exposed, glaring, in evidence, indisputable, lucid, manifest, noticeable, observable, open, overt, palpable, patent, perceivable, perceptible, plain, precise, prominent, pronounced, public, recognizable, self-evident, self-explanatory, standing out, straightforward, transparent, unconcealed, undeniable, undisguised, unmistakable, unsubtle, visible

… you get the point.

10.  For Some Phones, GPS is Vaporware.

Manufacturers may promise, but you must prove on each phone that GPS works as advertised before you design your products around it.  This means testing GPS on a particular make/model of a phone on a specific carrier.

11.  Time to First Fix is Always Slow.

If it’s not, then you didn’t get the first fix.  First fix can take minutes.

12. 3′

One meter accuracy is the best you can hope for.

13. Balance Accuracy with Time

The more accuracy you want from your fixes, the longer it take to get that fix.  And the harder it is to keep getting those fixes.  Simply changing your accuracy requirements to 20 meters can save you a lot of headaches.

14. GPS Fades In and Out, and Sometimes More Out than In.

GPS comes and goes.  Using an accelerometer is a good way to track your location when your GPS goes kaputt.

15. Allow the User to Use a Usable GPS Antenna

GPS antennas in cell phones are lame.  Always detect alternate GPS sources, like bluetooth antennas.

16.  If You Fly with Cell Phone GPS, You Die with Cell Phone GPS.

GPS doesn’t kill people.  But, GPS users navigating planes with cell phone GPS units can.  Cell phones should never be used for flight navigation.  If you write an airplane navigation tool on for a cell phone, you could be contributing to someone’s death.

17. Papers Before Positioning

Keep up to date on GPS research and papers.

18. Network GPS Isn’t Available on All Phones.

See #10.  But, if the cell phone you target can see a web server, consider setting up a server based location lookup (e.g. Secure User Plane Location – SUPL).  There are many servers out there you can set up yourself.


And now it's your turn ... comment here or on Twitter (@Androider)

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s