ponewheel / android-ponewheel

pOneWheel Android app
MIT License
71 stars 25 forks source link

[FR] Background Support #23

Open ebabel opened 6 years ago

ebabel commented 6 years ago

A background service would be a nice feature to add. So you can pull up maps, texting, camera, or whatever and still be logging.

ebabel commented 6 years ago

Might make instrumentation testing more difficult though. Gotta get those unit tests working.

audkar commented 6 years ago

How this should work? Most straightforward solution I can think is to refactor bt connection/tracking logging from MainActivity to foreground service. From user perspective this would look like:

With this solution would be possible to get rid of WakeLock but trade off is that notification will be always visible until tracking is stopped.

If this solution is OK then I can take this task

kwatkins commented 6 years ago

Hmm... having an always visible notification is fine I think. Constantly show a heads-up like dashboard with the current battery % and maybe speed, if it isn't too notification heavy.

Your method might be just fine, my thoughts when I saw this PR was wrapping the services in an actual Android Service (startService() etc) and passing the data via intents or http://square.github.io/otto/

Goal at the end of the day is to keep the app running, logging, etc - it's annoying that I'll be going, look down at the app, then will be disconnected. And would be great to see all the stats in the lockscreen notification, stretch goal :)

kwatkins commented 6 years ago

I've been using the master build for a couple of days. It's looking good, a few hiccup that I'm trying to track down and replicate - mainly related to power management. If I turn off the screen, BLE disconnects, and also seems to disconnect even with screen on at certain times. Logs are showing the BLE stack sending the disconnect... Sounds like power management stuff (Doze etc), adb commands can test power management triggers etc as well like app standby (https://source.android.com/devices/tech/power/mgmt)

Oh, the battery and speed gauge will freeze at times, stats etc still update. Likely due to the updates coming from different channels. I'm still tracking this one down.

audkar commented 6 years ago

Ok. If possible can you fill separate issue tickets for 100% identified problems please? I will try to solve them one by one. In meantime I am going to investigate how app behaves with doze in different android versions.