Most of the apps I currently use want to know my location. Some of them want this information for an obvious reason—a mapping service wants to help me decide a route as I drive to a new place, a recommendation app offers me restaurants nearby, and a weather app wants to know which city I’m in so it can display the relevant forecast. But geolocation is also used by my banking app, a used-stuff marketplace app, my alarm clock, my calendar, my notes and tens of other applications on my phone.
Maybe you decided to check out your phone’s settings too. If you did, I am confident you made the same discovery—most of your apps request access to your current location. This is today’s reality. Geolocation use in applications that do not primarily focus on delivering location-based services is now standard. And the reason is quite simple: when your app knows where your user is, it can adjust its services and improve user involvement and loyalty.
Applications can benefit from geolocation services in many ways. If you’d like to further engage your app users with the help of location-based services—the following article is for you!
How does a smartphone know its location?
There are several ways to identify where a smartphone (and its owner) are currently located.
GPS is a global system of earth orbiting satellites and receivers built into all modern smartphones and tablets. At any given time in any given location, a device can receive signals from several transmitters. This data is computed to determine the more or less accurate location of the device. One definite advantage of GPS—it doesn’t require a mobile or internet connection.
- Cell tower triangulation
User location can also be discerned with signals from the nearest cell towers. Depending on signal strength, a device can determine its distance from towers and estimate its position. This method is less accurate, but it works even when GPS is turned off.
Wi-Fi is helpful in locating a smartphone when both GPS and mobile networking are turned off. Much like cell tower triangulation, a user’s location can be uncovered when she connects to a Wi-Fi network with a limited service area.
- Assisted GPS
A-GPS combines all the methods described above. GPS signals are empowered by data from cell towers and Wi-Fi networks to more precisely calculate user position.
As you can see, unless you turn off all the ways your device connects with the world, it is almost impossible to hide your current location. Fortunately, people typically prefer to get most out of their devices and keep all the above services on. This means that your device knows where you are right now. But that information isn’t necessarily shared with every application.
How can an app get a user’s location?
There are several ways to enable your application to collect smartphone location information. Your strategy will depend on whether you build a native, hybrid or web application.
Find out about all technical nuances connected with geolocation.Contact us
Geolocation in native mobile applications
Native apps are created from scratch for each platform. The obvious advantage of this approach is that such applications are optimized for the operating system they are built for. As a result, they perform better and can directly access built-in smartphone features, including location. Of course, methods of procuring a device’s current location vary between different platforms. So let’s take a look at the two most popular: Android and iOS.
You can get the location of an Android device user using one of the following means:
- Google Location Services API
This API is a part of Google Play services and Google itself recommends it to extract the device’s location. Besides its high accuracy (when needed), this API limits power consumption, a feature appreciated by end-users.
- Package android.location
This API can determine device location using GPS. It’s more accurate but takes time. Approaches that work with connections to cell towers or Wi-Fi are less accurate but much faster.
Naturally, when developing for iOS a completely different set of tools is needed to enable the app to collect the user’s location.
- Standard Location Service
This is a frequently used strategy for receiving device location information. It works perfectly for both iOS and OS X. You can also configure the accuracy of location data and set the distance the user must travel before the smartphone reports a new location to the app.
- Significant change location service
This approach delivers updated information only after a significant change in user location has occurred. Correct configuration is crucial, otherwise, it can dramatically drain a device’s battery.
Enabling location services for hybrid apps
A hybrid app is built once but can be used on various platforms. This approach reduces development time and cost. But hybrid applications don’t offer the same level of user experience as native apps, even though modern frameworks for hybrid app development have become more powerful in enabling sophisticated functionality.
One of the drawbacks of a hybrid application is its inability to directly access a smartphone’s built-in features. But this doesn’t mean the app isn’t able to receive a device’s current position information. Procuring location data is still possible, but the approach will depend on the framework you’ve selected for hybrid app development:
The described plugins allow seamless access to device location and enable developers to adjust the accuracy and frequency of sent location data.
Location-enabled web applications
Web applications are often considered a good alternative to native and hybrid applications. These applications are actually websites that open in a desktop or mobile browser. Progressive web apps have become a recent trend because they’re more user-friendly and don’t lose their functionality when an internet connection is unavailable, which was the issue for traditional web applications).
When it comes to geolocation, web apps receive position information not from the device itself, but from the browser. For this purpose, HTML5 Geolocation API is used.
Ask users for permission to use their current location
Each of the approaches described above has one thing in common—before receiving a device’s location, you will have to obtain for the user’s permission. This is due to security concerns. Can you imagine what would happen if every application could access your current position without you being aware of this? To maintain your privacy, your smartphone will always ask for your permission to share its location.
Most smartphone users are cautious and won’t allow just anyone to know their current location. To win their trust, keep these simple tips in mind:
- Explain why you need to know your user’s location
Sometimes your reason for requesting this information is obvious, but sometimes it’s not. I don’t think twice when Maps.me asks for my current location. But when a notepad app wants to know, it can seem a bit suspicious to me. But, if my notes app explains that it wants to geotag my notes, that makes sense. It is important to avoid prompting your users to suspect you are misusing their private data. Be transparent. If you explain why you need their information, you are more likely to receive it.
- Request access to the location only through a user gesture
It may seem ridiculous, but when I download a news app, the first thing I see after launching it is a request to access my current location. Really? I haven’t even seen the app’s first screen. I haven’t been given the chance to test its functionality, and I definitely don’t even understand why it wants to spy on my position. To avoid this frustration, it is better to only ask for permission when a user launches a feature requiring geolocation. Luckily, Android 6.0 and newer allows developers to define when their apps request permission. This is a benefit because it allows your user to get acquainted with your service and build trust that can help obtain permission. In addition, users will understand why your app needs their geolocation, making them more likely to give you access.
- Minimize energy usage
The other day, I noticed that my smartphone’s battery died faster after I’d downloaded a new weather application! I quickly uninstalled the app and sought out a more economical alternative. Battery life impact is one of the main ways your app can disappoint users. To cut back on energy requirements, only extract location data when it is required for the app to function properly. Otherwise, your app is risking an unavoidable uninstall.
Sometimes geolocation is not enough to satisfy users. Think of Maps.me, Foursquare, Yelp or Uber. These apps don’t just receive your location, but also show you your neighborhood on the map and display information relevant to the app’s purpose. Users can view cafes or hotels in the area, drivers who are ready to accept their fare, or directions to get from one point to another.
If the features of your application require a map—you will definitely benefit from our article comparing the best mapping services. Don’t miss it!
Implementing location services in your application is a lot like exploring a new superpower. Suddenly, you’ll know where your customers are, what their habits and preferences are, and how to predict their wishes and pump them with offers they appreciate.
Making this feature a part of your application doesn’t have to be a big deal, but you do need to follow the best practices for each platform you work with.
We are ready to answer them all. Discuss your doubts with real professionalsContact us