abrensch / brouter

configurable OSM offline router with elevation awareness, Java + Android
MIT License
474 stars 113 forks source link

Question to "BRouter service is not available" in Osmand #632

Closed EssBee59 closed 9 months ago

EssBee59 commented 9 months ago

Hello!

The defect https://github.com/abrensch/brouter/issues/277 were closed, as the error did not occured in the last 2 years..

However, after a recent software migration, the error occurred again!

Platform: Smartphone: Xiaomi MI 12T Pro Android 13 MIUI 14 Brouter-app 1.7.3 Osmand 4.5.0

Problem: The routing & navigation with Osmand (using Brouter-app) starts successfully, but after a time between 20 and 50 minutes the error "BRouter service is not available" is reported in Osmand.

Cause: By starting Osmand open the IPC connection with Brouter-app (this creates a "brouter_service" backgroud process) The brouter_service should run untill Osmand is closed... but it sems that a Xiaomi "optimization" kills the service after a variable time,

The error "BRouter service is not available" is reported when Osmand tries to call the Brouter-app in that situation.

Brouter_miui14.txt

Workarroud: Underway my workarround was to close Osmand and start it again (a new brouter_service is started ... for 30 minutes or so..)

A running solution: I could find a running "solution": it consists to deactivate the "MIUI optimization". Two steps are necessary for that, this page describes how to proceed: https://www.gizmochina.com/guides/how-to-disable-miui-optimization/

As the solution above is not intuitive and not easy to implement, I liked to have a better (long term) solution

Examples: Change in Brouter-app to avoid that the brouter_service is killed. I am not sure whether it is possible (perhaps as foregroud services?), but it would solve the problem for each android smartphone and each navi-app.

An other idea is a change in Osmand: try once to reconnect the IPC in case of error. If no change in the Brouter-app is found, I think I will reopen the old corresponding issue in Osmand (https://github.com/osmandapp/OsmAnd/issues/10148)

afischerdev commented 9 months ago

I made some tests:

  1. run a small BRouter call every minute and write to a log. Runs for 2,5 hours and had no breaks. Only the calling routine has to be restarted after a while.
  2. run OsmAnd with a BRouter call and after that close BRouter via System/Settings/Apps. Run another BRouter call on OsmAnd (move target), no BRouter service as expected. But also no restart of BRouter, OsmAnd has a reconnect function but this is not called. Only a restart of OsmAnd works.

So I would think OsmAnd could do the job. You could do the same game with e.g. Locus. It will restart BRouter after a hard shutdown.

EssBee59 commented 9 months ago

Hello!

Thank for the tests and confirmation, that Osmand could /should do the work! (my question: is it possible to avoid the killing of brouter_service with a change in Brouter-app ==> amswer is NO)

As the change in Osmand is limited, I will reopen the corresponding issue as described above... and close this issue in some days if no new facts appear.

EssBee59 commented 9 months ago

Issue in Osmand: https://github.com/osmandapp/OsmAnd/issues/18244

SO, I close this issue!

EssBee59 commented 9 months ago

Not a bug in Brouter-app, no change seams possible to avoid killing of the background-process