Integrate Navigation into own Android App

Hey Forum,

I am currently working on my own android app and I do some calculations and method calls there and finally get latitude and longitude of one point where I want to navigate to and have the latitude and longitude from my current location. Now I have some options from here on:

  1. I embed an existing navigation on Android in my application.
  2. I start an extern navigation application via intent.

Both ways are used to help the user to navigate to the location.

When I finally reached the destination then my own app should handle this and send a message to a server. This is easier when my own app is in the foreground on the phone.

Some ideas what way I should use and if one explain me with what. I read something about Grasshopper etc. but I am not confident what to use.

Hopefully someone here can help me or just write down their opinion.

Kind regards
Ecou

I never did programming for Android,but from what I read, there are several ways to evoke navigation from inside an app. Either you pass the request for navigation to an external navigation app on the device or you embed a navigation via toolkit into your own app, e.g. https://docs.mapbox.com/help/tutorials/android-navigation-sdk/ .

There’s BRouter, which is intended to be used as a service by an app such as yours. There’s also a web interface for experimenting.

I use it as the routing engine behind Locus Map. It works well. But I can’t help you regarding how the integration works. Good luck.

There are various services you can use. They require an internet connection and (for you as the developer) an API key because you probably need to pay for the service if you reach a certain threshold.

  • OSRM - probably the fastest routing engine; server-side, so you always use it through a web API; static profiles, so you can not set certain preferences like “avoid slow zones”, “avoid steps”, “prefer separate cycle paths” etc… for each request; If I understood correctly, the “demo” instance is free for use, but I think it is routing for cars.
  • GraphHopper - has two modes, a static mode which is fast and a flexible (slower) mode where you can set preferences like mentioned above. The company which develops it offers it as a service. They advertise that it also runs offline on the smartphone, not sure how.
  • OpenRouteService. Fork of GraphHopper. Built a lot around GraphHopper, you can try out a lot of different configurations/profiles directly on their website. Not sure how/if it otherwise differs from GraphHopper.
  • Mapbox Navigation (using Valhalla). Valhalla is one of the newest routing engines. It is tile-based, which should allow to have a very small memory footprint when using it offline. Also as flexible as Graphhopper (they say)
  • BRouter was already mentioned. Has been around for quite some time and is considered the best router for bicycles. It’s offline navigation, no web API needed.

There are even more, but these are the ones I know and probably also the most known ones. All are open source.

These are all first and foremost routing engines, so you get some route and then it is up to you to lead the user to the location, the UI/navigation bit. If there is anything for that, I don’t know, but the most likely company that would distribute/sell such a pre-made navigation would probably be Mapbox.

Thanks guys for your answers!

@westnordost: I need the routing engine as well as the UI for it (a full but simple navigation app).
The app is just used for my bachelor thesis and will not be published like that for commercial use.

@PHersion: I will look into it.

@Viajero Perdido: Did I understand it right that BRouter is just the routing engine and Locus Map provides the UI?

Also I have to add that the navigation is used for cars and nothing else.

Kind regards
Ecou

Correct. You’d need your own UI. It does have a car mode.

Depends a lot on if you need more functionality than what google maps offers, if not just pass the route to google maps via intent
If you need offline routing OR you need to inject more functionality eg warn of something, account for sunstrike, warn trafficlights etc then there are several things you could consider.
Implementing your own is a challenge, but not impossible
You build a node table and then compare your gps points and bearing with the routes “nodes”
Graphhopper, which can route offline, has a demo that uses a very nice OSM derived OSCIM map, have a look here https://github.com/graphhopper/graphhopper/blob/master/docs/android/index.md