organicmaps/organicmaps

[android] Disable compass sensors update when it is not needed

Open

#9,196 opened on 2024年9月1日

GitHub で見る
 (5 comments) (0 reactions) (0 assignees)C++ (761 forks)batch import
AndroidBattery and PerformanceGood first issueNavigationTrack Recording

Repository metrics

Stars
 (7,887 stars)
PR merge metrics
 (平均マージ 13d 6h) (30d で 91 merged PRs)

説明

Compass updates are needed only in a limited number of places:

  1. When the map is visible (and the arrow on the map is visible)
  2. When the Place Page is visible with a small blue arrow pointing to the selected place
  3. When a small blue arrow from (2) is tapped and a big pointing arrow is displayed

Everywhere else compass (sensor) updates are not needed and should be disabled. Now they are always enabled.

The system should automatically pause compass updates when the app is in the background. But it does not happen when a foreground service is active. Meaning that active navigation and active track recording when OM is in the background will unnecessarily consume the battery.

CC @rtsisyk @kavikhalique

コントリビューターガイド