ge0rg / aprsdroid

APRSdroid - Geo-Location for Radio Amateurs
https://aprsdroid.org/
GNU General Public License v2.0
515 stars 101 forks source link

Excessive location requests when not connected over Bluetooth... #235

Open kf6gpe opened 5 years ago

kf6gpe commented 5 years ago

I'm seeing this in the following scenario on Android Q beta. It may happen elsewhere.

  1. Reboot phone.
  2. Start APRSdroid, connect via Bluetooth to my TH-D74A.
  3. Use as normal for an hour.
  4. Turn off the TH-D74A; Bluetooth silently disconnects. (I like that I can turn on the radio again and it automatically starts beaconing again.)
  5. Wait a half day (my work day) and use the phone.
  6. Battery life during this period is bad; a check of adb shell dumpsys location shows a lot of position activity by APRSdroid, even though it's not connected over Bluetooth.
  7. Reconnect to Bluetooth by powering on my radio again, position continues updating as I expect.

I haven't looked at the code, but I'm thinking what happens is the Bluetooth stuff shuts down normally, but the location tracking does not in the case where the Bluetooth TNC is shut down.

ge0rg commented 5 years ago

Yeah, you are right. The location part and the RF part are completely separate, there is no feedback channel from the latter to the former. APRSdroid will also try to reconnect Bluetooth every 3 seconds, which is not battery friendly either.

I'm not sure how much work it would be to solve this issue, as I'd have to integrate a back-channel to all location sources and have some more logic to delay transmission after re-activation of GPS (it's typically very much off in the first 10~30 seconds).