GPS App for Android

How to start a GPS with Android Intent

You are won­de­ring about the simp­lest way to start a GPS? We will show you how easy it is with an Android Intent.

In this artic­le we will show you the easiest way how to start a GPS with Android Intent. All you need to know is your destination!

What are Android Intents?

The Android ope­ra­ting system pro­vi­des a simp­le on-board tool to allow apps to com­mu­ni­ca­te with each other. Intents are a very simp­le way for one app to call ano­ther on the same device. Sim­ply put, Intents are URLs that, simi­lar to web pages, con­tain the reci­pi­ent and a func­tion to be per­for­med by the recipient.

For exam­p­le like this maptrip://navigate?latitude=50.738912&longitude=7.106772

YouTube

Mit dem Laden des Vide­os akzep­tie­ren Sie die Daten­schutz­er­klä­rung von You­Tube.
Mehr erfah­ren

Video laden

How to start GPS with Android Intent

How to start a GPS to a given location?

First, you need to spe­ci­fy who should recei­ve this intent: In our case and if you have instal­led Map­Trip you would spe­ci­fy “maptrip://

Next you need to tell the GPS what to do “navi­ga­te” (mea­ning to start a gui­dance) and whe­re to go to “?latitude=y&longitude=x”.

You will get the best and most robust per­for­mance if you use coor­di­na­tes instead of addres­ses. Coor­di­na­tes are unam­bi­guous while addres­ses can be very tricky and the­re may be mul­ti­ple simi­lar street names in one city which can only be dif­fe­ren­tia­ted by the­re ZIP code. The­r­e­fo­re, use the coor­di­na­te if you can!

Intents have no back channel

An Android Intent only pro­vi­des a uni-direc­tion­al com­mu­ni­ca­ti­on. You can tell an appli­ca­ti­on what to do, but it can not respond. The­r­e­fo­re it can­not tell you, if anything has gone wrong. 

Ima­gi­ne you use an intent to start a GPS to a given address. If that address is not uni­que or if some­thing was mis­s­pel­led, you would be stuck.

Use Map­Trip API for deeper integration

If you need that sort of work­flow, you should be using a deeper inte­gra­ti­on like the Map­Trip API. It pro­vi­des a back­chan­nel and thus more feedback.

Map­Trip can do much more than just gui­de you to a desti­na­ti­on. The­r­e­fo­re, the Intent inter­face also has num­e­rous func­tions that go bey­ond a simp­le trans­fer of coordinates.

In the video we explain a demo appli­ca­ti­on that we pro­vi­de in our Git­Hub account. It allo­ws deve­lo­pers to easi­ly see the pos­si­bi­li­ties of the Intent inter­face of our navi­ga­ti­on app.

If you need a deeper inte­gra­ti­on of navi­ga­ti­on in your own app, you can use the Map­Trip API. This crea­tes a feed­back chan­nel from the navi­ga­ti­on system into your own app, so that infor­ma­ti­on such as the cur­rent cal­cu­la­ted arri­val time (ETA) can be retrieved.

Skip to toolbar