Foursquare has built a loyal audience of 60 million users by letting them check into restaurants. Uber reached a market worth of $72 billion by connecting passengers and taxi drivers. Starbucks has increased sales by adding local notifications to its app. With more and more mobile app users every year, these companies will continue to grow their profit.
Number of Americans using geolocation apps;Statista.com.
In this article, I’ll share the insights we’ve gained when developing a location-based app, Juvo. It’s a native iOS and Android app for local communities of Norway.
Read the whole article or jump straight to the point you’re most interested in:
- Choosing a tech stack for:
- Anticipating the main problems:
Basically, your tech stack is determined by the platform (iOS/Android/Web) and business objectives.
To build a geolocation app, you’ll need two APIs – one to learn a user’s location and another to put those coordinates on a map.
These APIs provide all the tools you need to integrate location-based services (LBS) into your app without the need to develop them from scratch.
Now let’s see what choices you have.
To locate an iOS device, you can use:
- Google Maps API, the most popular map service in the world. It’s localized into most languages and is incredibly easy to integrate. You can customize the map’s colors to fit your brand image, modify road density or remove labels from the map.
- Core Location API from Apple uses CLLocationManager methods to locate a device, determine the direction it faces, its altitude or the proximity to an iBeacon.
Both are pretty accurate but let’s get a more detailed view:
- Data quality. This is the biggest ace up the Google’s sleeve. Six years after the release, Apple still hasn’t achieved a similar level of detail. Of all services, only Google Maps shows building outlines, even in tiny villages. It also has a 3D view of major cities. As explained by a former Apple Maps cartographer Justin O’Beirne, Google’s data is more extensive and accurate.
- Routing. Apple MapKit lists several routes for driving/walking while Google Maps provides a single route for driving or walking in addition to cycling and public transit. Google Maps also has a more accurate traffic information due to Waze partnership.
- Offline maps are unavailable in MapKit which is another minus.
- Indoor maps. Google provides indoor navigation for about 10,000 buildings around the world. Starting with iOS 11, Apple began adding detailed maps for major airports and malls. It plans to expand this feature offering a seamless transition between outdoor and indoor navigation.
- Pricing and data limits. MapKit is free and doesn’t have limitations on the number of API requests per day and the types of apps you can build with it. Google has recently changed its API pricing to a pay-as-you-go model. You get $200-worth of free requests per month which roughly translates to 100,000 map loads or 40,000 location calls. However, native apps with a simple Dynamic map can use the service for free.
Unless your app requires a massive amount of API calls, Google Maps remains the best choice for iOS geolocation.
To locate Android devices, you can use:
- android.location package (no longer recommended by the platform). If you already use it to detect user location, I’d suggest that you swap it for another API.
- Google Location Services API is easier to work with, provides more accurate results and has lower power consumption. It allows you to:
- Locate the user’s position via GPS, Wi-Fi, Cell ID, or A-GPS.
- Detect user movement and react to these changes with notifications or other actions.
- Determine the distance to selected places such as stores or cafes which can be used to set up geofences.
To visualize a location on a map, you can use:
- Google Maps API and MapView class. You’ll have to install the relevant Google App libraries before implementing the map functionality, otherwise the API isn’t supported by Android.
- Google Maps Directions API is used to provide directions and plan routes. It supports public transit, cycling, walking, and driving.
- Google Distance Matrix API determines the expected travel time depending on the chosen route, means of transportation, and traffic conditions.
Adding more location-based features to your iOS/Android app:
- Google Places API. Receive detailed info about places nearby including names, descriptions, user reviews and similar venues. The database contains 100+ million businesses all over the world. You can use the API to power your local business search, enhance navigation, provide directions and information about landmarks.
- Foursquare API for user recommendations, reviews, and ratings.
- Urban Airship API for local notifications and in-app messages. You can export data and statistics from push messages to get insights into your user base. You can view the reports in UA dashboard or integrate the API with your own reporting center.
- Facebook Places, Yelp API, and TripAdvisor API can offer additional insights into local businesses.
If you want to develop a web application with geolocation, you can use W3C Geolocation API. It’s supported by most browsers including Chrome and Safari but works only via https.
The API can show user location on the map as well as display recommendations and directions.
Location-based service features won’t work until users allow you to access their location.
Here’s what you can do to persuade them.
First, choose the right time to ask for permissions.
Hint, it’s not when the app is launched for the first time.
After seeing a dozen pop-ups in a row, many users would simply delete your app. The best moment to ask for permissions is when they access an location-based feature for the first time (e.g. tapping the ‘view on the map’ button).
Next, give enough context to make a decision.
“When people know why an app is using something as sensitive as their location — for example, for targeted advertising — it makes them more comfortable than when simply told an app is using their location” — Professor Jason Hong, CMU.
Note: on iOS 11, you have two kinds of location permissions: ‘always’ and “when in use”. Even if you need tracking in the background mode, you have to allow users to select the “when in use” option.
And if a critical permission gets rejected, you can provide a deep link leading to the relevant Settings screen. Just don’t forget to explain why it’s important.
The main reason people opt out of location tracking is the feeling that Big Brother is watching them.
According to Pew Research Center, 35% of users have disabled geo-tracking in their apps fearing that companies could get their hands on this data.
So here’s how you can alleviate these concerns
For starters, be transparent about what you do with user data.
How long do you store it? For what purposes? Do you collect the data that’s not strictly required to run your operations? Do you erase the data when it’s no longer needed?
Transparency is the foundation for trust and it’s often impossible to restore your reputation after a privacy violation.
In 2012 an app called Girls Around Me was pulled out of App Store. On the surface, it looked like your run-off-the-mill dating app. It allowed users to see the location of girls nearby and access their personal info.
None of the girls agreed to share their location.
In fact, they had no idea strangers were tracking them. The app used Foursquare’s public API to pull location data and extracted personal info from Facebook.
After the story became known to the public, Foursquare revoked the API access rendering the app useless.
Violating user privacy can have serious legal consequences.
If you handle personal data of even one EU citizen, you must comply with GDPR law or suffer fines of up to €20 million.
The law requires you to collect only the minimum amount of data, use it for intended purpose, use encryption and make sure users can completely erase their personal data from your databases and backups.
Read more here: how to make your application GDPR-compliant.
Next, offer true value in exchange for location data.
Often it’s enough to clearly communicate the value provided by your geolocation app.
People like personalized offers but nobody wants to be tracked by scammers.
So what can you do to protect user data?
- Make security a priority from the start. Following security best practices during development gives you a head start against possible attacks. Android and iOS provide a number of guidelines you can use to secure your app. It’s also recommended to review the app’s code with static analysis tools.
- Assess vulnerabilities in third-party components. Libraries and frameworks used in your project might have security holes that make your app vulnerable. It’s important to have a deep understanding of all third-party components in your app and keep up with library updates to prevent vulnerabilities.
- Use authorization best practices. Things like multi-factor authentication make it much harder for attackers to compromise accounts by combining passwords with another method of authentication (like an SMS code).
- Secure communication. Attackers can hijack or alter the sensitive data in transit. To prevent this, you should encrypt your communications and install an SSL certificate from a trusted authority. It’s also recommended to use Network Security Configuration feature on Android and App Transport Security on iOS.
- Secure the data storage. Storing unencrypted location data in files with insecure permissions presents another risk. It’s also not recommended to store sensitive data on user devices. . Otherwise, you should encrypt it with strong cryptographic algorithms like AES-256 or RSA.
Besides relevant notifications, gamification is one of the most effective ways to increase user engagement.
You can add various rewards, points and tiers to almost any kind of app.
The insanely successful GasBuddy rewards its 70+ million users for reporting prices at local gas stations. You can exchange the earned points for raffle tickets and win gift cards.
The app displays a leaderboard for added competitiveness.
You can also engage users with social features.
Foursquare acquired 50+ million monthly active users by allowing them to check into various places, rate them and share location with friends.
Further reading: how to win customers’ loyalty with location-based applications.
Many fitness apps allow users to view the routes they’ve traveled. Inaccurate GPS readings can distort those routes. Instead of going in a straight line, they’ll zigzag all over the map, cross rivers or fly over buildings.
Noisy GPS readings (left) vs accurate data (right) on the same route. Source: Fitbit community
One way to fix this issue is by using Google’s FusedLocation Client.
You can specify how often you want the location data to be updated (i.e. every 50 meters). The client matches location data to roads and pathways eliminating routes that go straight through buildings and other weirdness.
You can even set an accuracy threshold that blocks noisy GPS data.
Most apps don’t track users when running in the background mode. But if you rely on local notifications, persistent geolocation is essential.
While developing Juvo, we wanted to keep our users updated on the events happening around them. Without background tracking, notifications become less relevant.
To trigger background events in iOS apps, you’ll need to enable background location updates in Xcode. You’ll also have to change the allowsBackgroundLocationUpdates property of your CLLocationManager object to true.
On Android, apps running in the background can only receive location updates a couple of times per hour.
If your product relies on route tracking or local notifications, you can launch a foreground service by calling startForegroundService(). As the result, the service would appear as an ongoing notification in your notification area.
You can also use Geofencing API elements like GeofencingApi interface, create a passive location listener, or move the app to the foreground.
Apple’s marketplace is notoriously stingy with approvals. Your app can get rejected for a multitude of reasons or get stuck in the review hell.
Average app review times on App Store, days. Source:appreviewtimes. com
It took us three attempts to get the Juvo app approved.
GPS mobile solutions bear major security and privacy risks. That’s why Apple needs a detailed rationale for user tracking.
We got our metadata rejected because Juvo had persistent geolocation in the background mode.
Only after explaining that we needed this feature to provide relevant push notifications did App Store provide the greenlight.
Geolocation applications are notoriously hungry for power.
However, there are a few things you can do to prolong battery life.
First, consider your use case.
Can you reduce the GPS accuracy? Can you update location less frequently? Can you deliver location data with a greater delay? Can you disable background tracking?
All of these steps will reduce power consumption.
If that’s not an option, you can defer background location updates until x amount of time has passed or the device has traveled a certain distance.
It’s also recommended to turn off location updates when they aren’t required. You can, for example, set a timeout that would stop the updates after a certain amount of time has passed.
Finally, you can batch the location requests when running in the background and stop updating the location when GPS accuracy is below a certain threshold.
Now you what it takes to build a top-quality GPS app.
We’ve looked into the technologies behind geolocation and learned to how to choose the perfect tech stack. We’ve examined the main difficulties of location-based app development, from overcoming privacy concerns to improving GPS accuracy.
Now there’s nothing to worry about if you have a solid idea and an experienced team behind your back.
And if you have any doubts regarding the development process for your location-aware apps, you are welcomed to schedule a free consultation with MindK business analysts.