Closed biggt closed 2 years ago
Works fine on Pixel devices and on the emulator. Maybe it's your device?
"Background location permission" doesn't do what you think it does. See past issues on this topic.
I can second the report by @biggt No reliable background reports from owntracks on android
no option to grant permissons to 'always' report location (see screenshot)
battery management is enabled, but no app with extensive battery usage is shown, battery optimization is disabled for owntracks
p.s.: I checked #969 about background permissions. but: location reports from the android device offen occur delayed and in bulks and at random intervals when the device is locked or owntracks is in the background
Which mode? Significant changes or move mode?
Which mode?
"Significant Change".
I use both Android (am371) and iOS devices (ip359/osiph...) w/ similar regions defined and "significant change" mode.
Sometimes, timing is a few minutes apart (I think I used / unlocked my Android around 22:11...):
ts deviceid event desc reported
------------------- ---------- ---------- ---------- -------------------
2022-04-20 22:11:16 am371 enter MEMO-1 2022-04-20 22:11:21
2022-04-20 22:11:16 am371 enter MEMO-0E 2022-04-20 22:11:21
2022-04-20 22:11:16 am371 enter Monheim 2022-04-20 22:11:21
2022-04-20 22:11:16 am371 enter MEMO-0L 2022-04-20 22:11:21
2022-04-20 22:05:12 ip359 enter MEMO-0E 2022-04-20 22:05:12
2022-04-20 22:04:57 osiphtwo enter MEMO-0E 2022-04-20 22:04:57
2022-04-20 22:04:25 ip359 enter MEMO-0L 2022-04-20 22:04:25
2022-04-20 22:04:14 ip359 enter MEMO-0L 2022-04-20 22:04:14
2022-04-20 22:03:59 osiphtwo enter MEMO-0L 2022-04-20 22:03:59
2022-04-20 22:02:36 osiphtwo enter MEMO-1 2022-04-20 22:02:35
2022-04-20 22:02:36 osiphtwo enter Monheim 2022-04-20 22:02:36
2022-04-20 22:02:36 osiphtwo leave Langenfeld 2022-04-20 22:02:36
2022-04-20 22:02:24 osiphtwo enter MEMO-1 2022-04-20 22:02:24
2022-04-20 22:02:24 osiphtwo enter Monheim 2022-04-20 22:02:24
2022-04-20 22:02:24 osiphtwo leave Langenfeld 2022-04-20 22:02:24
Sometimes very close:
ts deviceid event desc reported
------------------- ---------- ---------- ---------- -------------------
2022-04-20 16:31:55 osiphtwo leave Nbg Gustav 2022-04-20 16:31:56
2022-04-20 16:31:02 am371 leave Nbg Gustav 2022-04-20 16:31:04
2022-04-20 16:28:27 ip359 leave Nbg Gustav 2022-04-20 16:28:27
2022-04-20 16:25:08 osiphtwo enter Nbg Gustav 2022-04-20 16:25:08
2022-04-20 16:23:06 am371 enter Nbg Gustav 2022-04-20 16:23:07
2022-04-20 16:22:29 ip359 enter Nbg Gustav 2022-04-20 16:22:29
Sometimes long time apart - e.g. the "NUNU-0L" with 9.06 vs 10.58 (all devices w/ significant change mode, owntracks in background + device/screen locked):
ts deviceid event desc reported
------------------- ---------- ---------- ---------- -------------------
2022-04-20 10:58:30 am371 leave NUNU-0L 2022-04-20 10:58:29
2022-04-20 10:58:30 am371 enter Ak @ Nbg 2022-04-20 10:58:29
2022-04-20 10:58:30 am371 leave NUNU-0E 2022-04-20 10:58:29
2022-04-20 09:19:41 ip359 leave Nbg BR Pfo 2022-04-20 09:19:41
2022-04-20 09:18:10 ip359 enter Ak @ Nbg 2022-04-20 09:18:10
2022-04-20 09:18:10 ip359 enter Nbg BR Pfo 2022-04-20 09:18:10
2022-04-20 09:17:45 osiphtwo enter Ak @ Nbg 2022-04-20 09:17:45
2022-04-20 09:17:03 ip359 leave Nbg Gustav 2022-04-20 09:17:03
2022-04-20 09:16:50 osiphtwo leave Nbg Gustav 2022-04-20 09:16:50
2022-04-20 09:15:18 ip359 enter Nbg Gustav 2022-04-20 09:15:19
2022-04-20 09:14:49 osiphtwo enter Nbg Gustav 2022-04-20 09:14:49
2022-04-20 09:06:51 osiphtwo leave NUNU-0L 2022-04-20 09:06:52
2022-04-20 09:06:38 osiphtwo leave NUNU-0L 2022-04-20 09:06:38
2022-04-20 09:06:38 ip359 leave NUNU-0L 2022-04-20 09:11:40
2022-04-20 09:06:22 ip359 leave NUNU-0L 2022-04-20 09:11:40
2022-04-20 09:05:57 ip359 leave NUNU-0E 2022-04-20 09:11:40
2022-04-20 09:05:47 osiphtwo leave NUNU-0E 2022-04-20 09:05:47
Do you see the same issue in move mode?
no, in move mode it's fine:
this is the resulting raw mqtt data with moveModeLocatorInterval: 15
- quite close:
owntracks/.../am371 {"_type":"location",...,"conn":"w","created_at":1650645014,"inregions":...,"tst":1650645013,...
owntracks/.../am371 {"_type":"location",...,"conn":"w","created_at":1650645044,"inregions":...,"tst":1650645044,...
owntracks/.../am371 {"_type":"location",...,"conn":"w","created_at":1650645076,"inregions":...,"tst":1650645076,...
owntracks/.../am371 {"_type":"location",...,"conn":"w","created_at":1650645091,"inregions":...,"tst":1650645091,...
owntracks/.../am371 {"_type":"location",...,"conn":"w","created_at":1650645106,"inregions":...,"tst":1650645106,...
owntracks/.../am371 {"_type":"location",...,"conn":"w","created_at":1650645121,"inregions":...,"tst":1650645121,...
owntracks/.../am371 {"_type":"location",...,"conn":"w","created_at":1650645136,"inregions":...,"tst":1650645136,...
owntracks/.../am371 {"_type":"location",...,"conn":"w","created_at":1650645138,"inregions":...,"tst":1650645136,...
owntracks/.../am371 {"_type":"location",...,"conn":"w","created_at":1650645151,"inregions":...,"tst":1650645151,...
owntracks/.../am371 {"_type":"location",...,"conn":"w","created_at":1650645168,"inregions":...,"tst":1650645151,...
owntracks/.../am371 {"_type":"location",...,"conn":"w","created_at":1650645175,"inregions":...,"tst":1650645174,...
owntracks/.../am371 {"_type":"location",...,"conn":"w","created_at":1650645183,"inregions":...,"tst":1650645183,...
owntracks/.../am371 {"_type":"location",...,"conn":"w","created_at":1650645198,"inregions":...,"tst":1650645198,...
owntracks/.../am371 {"_type":"location",...,"conn":"w","created_at":1650645206,"inregions":...,"tst":1650645205,...
If it works in move mode, it's likely not a permissions issue. There's no difference in permissions between different modes of the app.
If it helps, I've attached a build (24710) that has the android.permission.ACCESS_BACKGROUND_LOCATION
permission set in the manifest. It won't set it explicitly, you'll need to add it in over at the Android application settings screen (in your screenshot). Try using that and see if you see a difference in significant changes mode.
Thank you @growse - unfortunately the .apk won't install on my phone ("you cannot install the app on your device"). I tried after quitting and even deinstalling build 24704 and also enabled developer mode -> nothing helped.
I'll carry on searching...
Found one setting that was changed on the Android (ignoreInaccurateLocations=50) compared to the iOS devices (ignoreInaccurateLocations=120): As the Armor 8's GPS is not always the best, this might be the culprit for missing location updates and late region events. Now, I set this to 120 on the Android too and will see.
The Huawei Mate 20 Lite my wife has started using (say nothing about the washing machine) is the same.
The application can only access the location functions of the phone when it is open and on top. In the background the app keeps running but it cannot get the location. Most of the Apps have the same challenge, but some do have the option for "Allowed all the time". It seems that the default option is "Allowed only while in use" and something in the app makes the "Allowed all the time available"
@growse I'm not able to install the debug apk you published above to test it. I removed the installed one from playstore first. But it always say "not installed" without a further error message. What I can tell with nexttrack fork from f-droid it is working well, when setting the permission to "always" instead of "Allowed only while in use".
The Huawei Mate 20 Lite my wife has started using (say nothing about the washing machine) is the same.
The application can only access the location functions of the phone when it is open and on top. In the background the app keeps running but it cannot get the location.
Is this is all modes, or do you only see this in certain modes (Significant Changes, Move etc.)
I'm not able to install the debug apk you published above to test it. I removed the installed one from playstore first. But it always say "not installed" without a further error message. What I can tell with nexttrack fork from f-droid it is working well, when setting the permission to "always" instead of "Allowed only while in use".
Without a logcat, I'm not really able to figure out why the apk won't install.
The challenge here is that I don't have an enormous range of different devices to test on, so it's pretty challenging to reproduce any of these behaviors to try and figure out what's going on. As I've said in the past, I don't see this on any emulator or any of the real devices that I have available to test on, so if there is an issue with a device, I'm relying on someone who owns that to be able to do some thorough testing in order to try and narrow down the issue.
One thing that should be possible for the next release is to build the F-Droid/OSS flavour with background permission in the manifest, and that should then give us a sensible point of reference to test. Hopefully then people can compare behavior on the same app between allowing "always" and "only when using" and see what differences there are.
The challenge is that always does Not show as an option for own tracks. Insurance couldn't fix the old phone and she was sent a galaxy note 10 as a replacement. This abo does not allow the location to be used unless the App is in use. It runs at startup but does nothing unless you run the app
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Andrew Rowson @.> Sent: Saturday, May 28, 2022 1:19:08 PM To: owntracks/android @.> Cc: tre4b @.>; Comment @.> Subject: Re: [owntracks/android] OwnTracks on Android not able to continue reporting location when not using the app, no option to enable "Allow all the time" location permissions. (Issue #1199)
The Huawei Mate 20 Lite my wife has started using (say nothing about the washing machine) is the same.
The application can only access the location functions of the phone when it is open and on top. In the background the app keeps running but it cannot get the location.
Is this is all modes, or do you only see this in certain modes (Significant Changes, Move etc.)
I'm not able to install the debug apk you published above to test it. I removed the installed one from playstore first. But it always say "not installed" without a further error message. What I can tell with nexttrack fork from f-droid it is working well, when setting the permission to "always" instead of "Allowed only while in use".
Without a logcat, I'm not really able to figure out why the apk won't install.
The challenge here is that I don't have an enormous range of different devices to test on, so it's pretty challenging to reproduce any of these behaviors to try and figure out what's going on. As I've said in the past, I don't see this on any emulator or any of the real devices that I have available to test on, so if there is an issue with a device, I'm relying on someone who owns that to be able to do some thorough testing in order to try and narrow down the issue.
One thing that should be possible for the next release is to build the F-Droid/OSS flavour with background permission in the manifest, and that should then give us a sensible point of reference to test. Hopefully then people can compare behavior on the same app between allowing "always" and "only when using" and see what differences there are.
— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fowntracks%2Fandroid%2Fissues%2F1199%23issuecomment-1140250180&data=05%7C01%7C%7C684152295f0b4163c99d08da40a444c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637893371518112942%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=PASOWGnyuZZY2yR%2FS%2Fy3Uo1DRs0D9sbJcrGxQAHNTIw%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJBDTMNYO7WTBBIMJO4B5SLVMIFLZANCNFSM5UAIYGQA&data=05%7C01%7C%7C684152295f0b4163c99d08da40a444c7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637893371518112942%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=XkFUwuY3BsUSr1%2FKkDeuKV9HsE3lEfysz2PgVeY0Y3U%3D&reserved=0. You are receiving this because you commented.Message ID: @.***>
OwnTracks not being able to fetch a location without an explicit user interaction (ie opening the app) is a separate issue to the one originally posted here, which is about the app not receiving locations after it has been opened and then put into the background.
Sounds like the same thing then.
When you start the phone you get an OwnTracks entry in the notification bar telling you what mode it is in. Often also a logo at the top left. But no tracking happens unless you open the actual app.
That's when I investigated the permissions for location and found the only option is While the app is in use.
Google maps and a few other Apps do have an always option so it feels like this might be something that needs something in the code or something they have to certify or similar
Thev
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Andrew Rowson @.> Sent: Saturday, May 28, 2022 2:53:53 PM To: owntracks/android @.> Cc: tre4b @.>; Comment @.> Subject: Re: [owntracks/android] OwnTracks on Android not able to continue reporting location when not using the app, no option to enable "Allow all the time" location permissions. (Issue #1199)
OwnTracks not being able to fetch a location without an explicit user interaction (ie opening the app) is a separate issue to the one originally posted here, which is about the app not receiving locations after it has been opened and then put into the background.
— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fowntracks%2Fandroid%2Fissues%2F1199%23issuecomment-1140269117&data=05%7C01%7C%7C79d2a1179c8845d214cb08da40b18162%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637893428361729462%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=QeH0w%2Bm6KWfypxA0l%2FReWsGQYNnwYzX%2BbI%2BGBHlcdIg%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJBDTMPPOE52LVTCBNJN543VMIQPDANCNFSM5UAIYGQA&data=05%7C01%7C%7C79d2a1179c8845d214cb08da40b18162%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637893428361729462%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=bqkyLdnBwPhTJqX%2FV7ZDBDZGiTuk0vohuEcno%2BWmE4g%3D&reserved=0. You are receiving this because you commented.Message ID: @.***>
Sounds like the same thing then. When you start the phone you get an OwnTracks entry in the notification bar telling you what mode it is in. Often also a logo at the top left. But no tracking happens unless you open the actual app.
Yes, because recent Android versions (you've not said which you're using) Google don't let apps that have been started in the background (ie by a boot event) to receive locations using foreground services unless they ask for the ACCESS_BACKGROUND_LOCATION
permission. OT pops up a second notification to tell you this.
I can confirm, that the option "always enable" does not show up for the location permissions on my new Fairphone 4 with Android 11. It still seems to report locations, if it's in "move mode".
I just wanted to revisit this since I originally opened this; I'm not sure what changed, but in the last few weeks OwnTracks has been working fine. As @growse mentioned a few days ago, the opening of the app after startup for the first time to allow it to track is a non-issue for this issue thread.
OwnTracks has continued to track me using the Significant Changes mode and doesn't give me too much issue. Move mode is too much and drastically impacts my battery life. We can certainly leave this thread open since so many others are having similar issues as I was when I opened this thread.
Curious. Did you do any device firmware updates recently?
I can confirm this on my Fairphone 3+ running LineageOS 18.1 (Android 11). This is really bad, because we added Owntracks on 2 phones of elderly persons to find them if something happens too.
On my FP3+ to keep reporting to mqtt/owntracks recorder running i start navit in the forground, which keeps screen unlocked nd Owntrack keeps running, but this is a bad battery drainer. Hopefully there is a solutions soon.
Even if owntracks can't use a background service in the play store version, what prevents it from using that for the oss version, so that at least f-droid users don't have to manually start owntracks/click the notification every time they restart their phone?
Just an Note: I run LineageOS 18.1 on Fairphone 3+ and even i manually start Owntracks after reboot it stops reporting later. I keep Navit on top, which prohibits screen lock, then Owntracks also reports in the background. But currently Owntracks is kinda unusable for live view of locations which makes it a problem for me because of not beeing ablet to track eldery family members in case of emergency.
Even if owntracks can't use a background service in the play store version, what prevents it from using that for the oss version, so that at least f-droid users don't have to manually start owntracks/click the notification every time they restart their phone?
This is a good point, and I've got it on the backlog. Should be fairly straightforward once I find some time to implement. Hopefully will be in the next version.
It seems that there is no way for OwnTracks to reliably continue reporting location because of the way Android is limiting the app, or the way the app is coded.
When you go into the App Management, choose OwnTracks, go to Permissions, then Location... I do not have an option that allows OwnTracks to continue reporting location in the background. The only options available are:
When you look at something like permissions for Google Maps, you have the option for "Allow all the time". I believe that this is causing OwnTracks to continue not reporting accurately movements to/from zones.