Open binod-techindustan opened 4 years ago
First of all I would suggest using foreground service for background navigation(see example). In that case system will keep your app a bit longer.
1.Resuming navigation
HERE SDK does not provide functionality for resuming navigation after app was killed by the OS.
If user goes back to the app after some time, to resume navigation you would need to (1)have most recent GPS location, (2)route itself, (3)navigation settings and (4)map state. The (1), (3) and (4) can be achieved on the app side. For the (2) you can use Route.serializeAsync(...)
to serialize route so it can be retrieved using Route.deserializeAsync(...)
after app was killed.
2.Restarting MapEngine
After process was killed by the OS, MapEngine
should be re-initialized using MapEngine.init(...)
or mapFragment.init(...)
.
When running application in background and after device perform some multitasking like openning some others app and then resume the Navigation, maps fail to load and navigation stops. This occurs mostly in low end device having 2-3GB Ram. So how can we restart the map engine and and resume the ongoing navigation?