location-samples icon indicating copy to clipboard operation
location-samples copied to clipboard

Geofence latency may be off by hours

Open artstwolf opened this issue 6 years ago • 3 comments

Phone: Pixel 3 Android version: 10

I modified the Geofencing App in this repo to write to a file when certain geofence enter and exit events occurred. I also made the geofence radius 150 meters and made the geofences never expire.

I turned my screen off overnight and placed my phone on the table. In the morning, I put my phone in my pocket without turning the screen on or interacting with it in any way.

The latency of the geofence events recorded in the morning exceeded the 6 minutes referred to in Android's documentation. In the worst case, the geofence exit which should have occurred at 8:56 am didn't trigger until I interacted with the phone at 1:18 pm.

2019-08-07 07:08:08 Entered: Geofence B (6:56am, actual)
2019-08-07 07:08:08 Exited: Geofence A (6:51am, actual)
2019-08-07 07:50:57 Entered: Geofence A (7:43am, actual)
2019-08-07 07:50:57 Exited: Geofence B (7:41am, actual)
2019-08-07 13:18:09 Entered: Geofence C (9:11am, actual)
2019-08-07 13:18:09 Exited: Geofence A (8:56am, actual)

The app standby state is currently WORKING_SET, so I was wondering if it had to do with that or new Doze definitions.

According to Android's documentation, Doze should not be the culprit because the phone was in motion.

As soon as the user wakes the device by moving it, turning on the screen, or connecting a charger, the system exits Doze and all apps return to normal activity.

I would appreciate any advice or insight into this behavior. Geofence latency greater than 10 minutes is bad. Geofence latency of several hours is terrible.

artstwolf avatar Aug 07 '19 21:08 artstwolf

This issue may be related: https://issuetracker.google.com/issues/123005658.

artstwolf avatar Aug 20 '19 18:08 artstwolf

@artstwolf You mentioned that your app was in the working_set . I have been testing the effects of moving our app up and down the power buckets and I have observed that if the application on frequent or rare, the geofence will not trigger, unless the device is connected to power . Is this expected ? because to be honest I don't think that users will open my application everyday and hence I think for most users it will be in the frequent or rare bucket .

justaaq avatar Oct 17 '19 12:10 justaaq

Bump. I'm still seeing my issue and would appreciate feedback from the Android team

artstwolf avatar Dec 13 '19 19:12 artstwolf