Hello, in triying to make an app on android studio with offline routing (so i dont have any app costs or the need for internet), but im a bit lost. I can show the map with mapsforge but the routing its hard. Any kind of quick start guide? The offline android project gives a 404 on github. What parts of the library should i get in my project? I tried to build the code to have the core/reader and all that in my project but im not able to get any jars, im using intelij idea for it
Any idea guys?
Hi there,
Offline is not officially supported, but there are ways to make it work.
Here is the quickstart (make sure you’re on tag 1.0, you likely got 404 because you were on master or a branch/tag that had dropped support for offline)
The critical file is graphhopper.sh, this is what gives you usable local files. Without modification, this script will only work with the tag it is on i.e. you can only use files built with the 1.0 script with the 1.0 library.
Now, offline support was dropped after 1.0, but graphhopper.sh exists until 4.0, and I have found that the quick start guide will work on 4.0 without any changes, you just have to adhere to the same tag rule, meaning that the graphhopper you run on the phone will have to be 4.0. Beyond this point, to be honest I don’t know, I believe it’s possible to modify graphhopper.sh for later tags but I haven’t done it.
it is possible to build and run graphhopper as a lib for android (last time I checked it was graphhopper 5.3). You can use usual the API to do routing if you for instance have the graph-cache already calculated and downloaded to the device and specified in the configuration. That way the GraphHopper instance will recognize the already existing data and you can route. The essential routing is done by creating an GHRequest, setting the points and call route with the request. GHResponse is your response.
And btw you need to use memory mapped data access in the config file, otherwise the memory footprint will be too large for a phone.
graph.dataaccess: MMAP