mrc's Cup of Joe Blog

Join us in exploring the world of modern development, evolving technologies, and the art of future-proof software

How to use GPS in your mobile web apps

EducationHere’s something you may not know: Did you realize that mobile web apps and native apps are nearly equal in terms of capabilities? It’s true. As you learned in this article from a few weeks back, mobile web apps are much more powerful than most people think.

As promised in that article, I’m going to go through some of those “native” features and explain how to use them in your mobile web apps. Today, let’s take a closer look at the first feature on the list: GPS. Specifically, I’m going to show you how to use GPS in your mobile web apps, and also give you a few ideas on ways to use it.

Ready? Let’s get started…

How to use GPS

Using GPS in mobile web apps is actually quite simple thanks to HTML5’s geolocation API. Without getting too technical, here’s what it does: Geolocation lets your mobile web application use the device’s GPS to pin-point the user’s longitude and latitude coordinates. How can you use geolocation? We’ve written up a full tutorial complete with a demo, which you can find right here.

A few ideas

Now that you know how to use GPS in your mobile web apps, let’s tackle another big question: What exactly can you build? The possibilities go far beyond simply getting the user’s location. For instance, here are a few types of mobile web apps you can build when you take advantage of GPS:

  • Trip meter apps that can calculate distance traveled
  • Check-in apps that let users check in to specific locations
  • Discovery apps that let users find things nearby
  • Tracking apps that let customers see their shipment’s progress
  • Turn-by-turn navigation apps (if used with the accelerometer)

Conclusion

Many people assume that taking the mobile web app route means they must sacrifice features. The fact is, mobile web apps are far more powerful than most people think. Today, we learned how to use GPS with mobile web apps, but this is only the tip of the iceberg. Over the next few months, I plan on covering even more “native” features that you can use with mobile web apps. Stay tuned…

4 thoughts on “How to use GPS in your mobile web apps”

  1. Thanks for this. But the key thing a mobile web app needs to do for any of this to work is to turn on the phone’s GPS when it’s off. Is there any way for a mobile web app to do this?

  2. Joe Stangarone

    Hi Storm,

    Great question! From what I’ve seen, you can’t turn on the phone’s GPS with any type of application…even native apps. The best you can do is send the user to the settings screen so they can enable it themselves.

    Now, I have encountered certain apps in the past (tasker and llama come to mind) that could enable and disable GPS. Apparently, this was a result of a security bug exploit that has since been fixed.

    So, to answer your question, it looks like GPS control is up to the user–in any type of app. The best you can do is alert the user to enable the GPS.

Comments are closed.