mrc's Cup of Joe Blog

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

Yes, you can use GPS with mobile web apps (with proof)

EducationThere’s a lot of misinformation being spread about mobile apps. Just last week, I read yet another article from yet another mobile app “expert” that made me cringe. The article falsely claimed that native apps are necessary if you want to use the phone’s hardware sensors, like the GPS.

Okay. Let me set the record straight: No, they’re not!

Native apps are not required to use the phone’s GPS, and that’s just the beginning. Mobile web apps can actually access almost every hardware sensor that a native app can access. If you’d like to learn which sensors a mobile web app can access, read this article.

So, how can you access the GPS using a mobile web app? It’s simple, and we have two short tutorials and a demo to prove it.

This tutorial explains how to use the HTML5 geolocation tag, which lets a web app access the GPS sensor.

This tutorial goes one step further, and builds a demo check-in app using geolocation and photo uploading. Make sure you check out the example on your smartphone.

Why is this so important?

Many companies believe they need to build native apps in order to access a smartphone’s hardware sensors. Not only is this thinking wrong, it can waste significant amounts of both time and money. You see, native apps are more difficult and expensive than mobile web apps, and usually don’t make sense from a business standpoint. To learn why, read this article entitled, “7 reasons why mobile web apps are better for business than native apps.”

5 thoughts on “Yes, you can use GPS with mobile web apps (with proof)”

  1. The two explanations are very good but they dont answer why the html5 gps is far less accurate than using for example google maps or google maps which are native apps. I have been trying to get hold of high accuracy readings but outside the city the html5 map tells me that I am somewhere in a field and not the location I am actually at :/ so why is it that the further I get from cell towers in html5 the gps signal fades away?

  2. This is a good example, but is there a way to do it without asking the user to approve the request each time? and can this location be implemented into a mobile app?:

  3. The user must agree to share their location with a web application initially, but once they’ve agreed, their preferences are saved in the browser. It shouldn’t ask the user every time.

    Yes, the location can be implemented into a mobile app. Check out this demo on a smartphone: http://www.crazybikes.com/mrcjava/servlet/CRAZYBIKES.M07050s. Once you click “Check in your location” the browser will ask you if you would like to share your location. If you agree, the latitude and longitude fields automatically populate.

  4. Thanks for the tip. now assuming the information would be provided. How can an app determine those around me in a 1 mile radius using the same app based off of their geo data? Or if you can point me in the direction of a tutorial or information on this.

    1. That’s possible, but there are some limitations. If you’re building a web application, all of the users must be using the app for it to broadcast their location. As soon as they shut their browser down, it stops broadcasting location. A native app will run in the background and broadcast location, but you’re looking at some fairly complex server-side algorithms to determine location and distance relative to other users.

      It all depends on what you’re looking to accomplish.

Comments are closed.