I have configured the settings for my foreground service like below:
val settings = Settings(
scanStrategy = Settings.ForegroundServiceScanStrategy(
notification, 456
),
scanPeriods = Settings.ScanPeriods(10000L, 30000L, 10000L, 30000L),
longScanForcingEnabled = true
)
beaconManager.replaceSettings(settings)
It should wait for 30 seconds and then scan for 10 seconds in both foreground and background. Thus, one scan cycle will be of total 40 seconds.
The problem is when the app is killed and the device screen is off, the scan intervals are not regular, i.e they are not exactly 40 seconds. I have observed few cycles as low as 1 seconds and as high as 140 seconds.
Otherwise, when the device screen is on, the scan cycles are exactly at 40 seconds irrespective of the app is in the foreground or background.
The device I am using is Samsung M31 which runs on Android 12.
Is there any issue with the device hardware/software or some setting has to be configured in the library?
The library version is 2.21.1