bailuk / AAT

Another Activity Tracker for Android
https://bailu.ch/aat
GNU General Public License v3.0
150 stars 41 forks source link

Suggestion: add option to keep tracking while app not in foreground #130

Closed rparkins999 closed 1 year ago

rparkins999 commented 1 year ago

See rparkins999/AAT, which does it, but it really needs implementing properly.

ANDREW007CZ commented 1 year ago

what do you mean? it works fine on possibly every device but you need to set all the battery saving features OFF for this app, and also give it permission to be able to always access position/gps and other sensors.

rparkins999 commented 1 year ago

It did seem to stop tracking if I turn my phone off. Of course it won't work if I power the phone down completely by a long press on the power button, but it stopped tracking if I just put the phone into standby with a short press on the power button, or if I bring another app in front of it, and it seemed to get errors when I tried to wake it up again. In particular logcat reports leaks of broadcast receivers which don't get unregistered when the activity that registers them is destroyed. I've been working on my fork to fix this.

The loss of tracking in standby may be due to the fact that I hadn't originally realised that I need "Allow all the time" permission for Location. I don't think that the documentation mentions this, and it would perhaps be helpful if it did. You do ask for ACCESS_BACKGROUND_LOCATION permission in the manifest, which worked for older versions of Android. The current Android-approved solution is for the app to ask for the permission when it finds that it needs it and doesn't have it. I don't necessarily agree with that: I think a sensibly designed operating system should do that sort of thing for you. and not make every app author write extra code to deal with it. However IMHO Google didn't design the Android permission system properly in the first place and has been hacking it since to try and make it work better. At any rate I think that it would be better to do something to tell the user that that ACCESS_BACKGROUND_LOCATION permission needs to be granted explicitly: Most users won't have read the developer documentation. Richard

On Tuesday, 2 August 2022, 07:33:48 BST, ANDREW007CZ ***@***.***> wrote:  

what do you mean? it works fine on possibly every device but you need to set all the battery saving features OFF for this app, and also give it permission to be able to always access position/gps and other sensors.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

rparkins999 commented 1 year ago

OK, the original version (with my autoincrement patch so that I can build it) does work on the phone with the screen off if it has "Allow all the time" permission for Location. The receiver registration errors that I saw seem to have been caused by my attempts to hack the code to make it work with the screen off. In order to use the step counter, it needs "Body sensors" permission allowed in the settings page. This also doesn't seem to be mentioned in the documentation, and the app doesn't explicitly ask for it if it isn't granted when you tell the app in the Preferences page to use the step counter. I agree this is Google's fault for changing the rules so as to break existing apps, but it's confusing for users. On latest versions of Android, the user also needs to turn off "Remove permissions if app is unused" (the default is "on"), otherwise Android will take the permissions away again (without telling you) if you don't use the app for a while. Richard

On Tuesday, 2 August 2022, 09:50:32 BST, richard parkins @.***> wrote:

It did seem to stop tracking if I turn my phone off. Of course it won't work if I power the phone down completely by a long press on the power button, but it stopped tracking if I just put the phone into standby with a short press on the power button, or if I bring another app in front of it, and it seemed to get errors when I tried to wake it up again. In particular logcat reports leaks of broadcast receivers which don't get unregistered when the activity that registers them is destroyed. I've been working on my fork to fix this.

The loss of tracking in standby may be due to the fact that I hadn't originally realised that I need "Allow all the time" permission for Location. I don't think that the documentation mentions this, and it would perhaps be helpful if it did. You do ask for ACCESS_BACKGROUND_LOCATION permission in the manifest, which worked for older versions of Android. The current Android-approved solution is for the app to ask for the permission when it finds that it needs it and doesn't have it. I don't necessarily agree with that: I think a sensibly designed operating system should do that sort of thing for you. and not make every app author write extra code to deal with it. However IMHO Google didn't design the Android permission system properly in the first place and has been hacking it since to try and make it work better. At any rate I think that it would be better to do something to tell the user that that ACCESS_BACKGROUND_LOCATION permission needs to be granted explicitly: Most users won't have read the developer documentation. Richard

On Tuesday, 2 August 2022, 07:33:48 BST, ANDREW007CZ ***@***.***> wrote:  

what do you mean? it works fine on possibly every device but you need to set all the battery saving features OFF for this app, and also give it permission to be able to always access position/gps and other sensors.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ANDREW007CZ commented 1 year ago

I understand. On the other hand, AAT is not an app reaching average users but rather somewhat advanced ones instead. Documentation might not have been updated with latest release. It seems to me bailuk has already other things to attend to instead of keeping this app in the best condition. That I don't mean in a bad way, simply deducing by a pace of new updates. He owes us nothing and i'm happy this app is FOSS. Still, it is a best app I have found for my needs. But for the newest Android it needs some updates. Maybe you can make a Pull request?