Closed hotchemi closed 2 years ago
I understand that not all apps need background detections, but many do. The library is designed to make it as easy as possible to allow that.
Rather than changing the default library behavior and potentially breaking thousands of existing apps that might upgrade the library, why not simply override the definition in your appโs manifest with tools:node=โreplaceโ
?
For other users who want to eliminate that permission, perhaps a documentation page with instructions would suffice.
Totally agree with you. Let me update ๐
Updated. c49f65825a8dabe3c641ca20001ab98358ac8480...05dadd5df75885b46785bd0e0b59ef34072479c5
Could you take a look when you have time? ๐
Hi~any update? ๐
Hi, @hotchemi. Apologies, I misunderstood that a key part of this PR is to allow configuration in the manifest that the job is not persisted. Because I did not understand this, I thought my last suggestion had resolved the issue for you.
Is there a reason that you need this configured in the manifest? It seems it would be much simpler to have a method to configure this, say:
beaconManager.setJobPersistenceEnabled(false)
Then just set this once in your code if you do not want the default persisted jobs.
Ultimately the library is going to be moving to a new configuration API that is exclusively programmatic (not declared in the manifest), so this might be a better fit.
I think if we make this a method in BeaconManager, this change will only be about 10 lines of code.
Thoughts?
Ultimately the library is going to be moving to a new configuration API that is exclusively programmatic (not declared in the manifest), so this might be a better fit.
@davidgyoung Thx for the feedback!
Is there a reason that you need this configured in the manifest?
This is just to keep API consistency with longScanForcingEnabled and I don't have a strong opinion around here๐ But presumably we should follow after you accomplish migration to the new programmatic API?
We're using the forked version with this change and it's kinda not urgent now, it's also fine closing the PR and waiting for your work๐
@hotchemi please see the ScheduledJobScanStrategy section here. Will this kind of API work for you?
@davidgyoung Thx, I checked the doc and scheduledJobScanStrategy.jobPersistenceEnabled = true
looks good to me ๐
Then let me close the PR. thx!
related: https://github.com/AltBeacon/android-beacon-library/issues/622
Summary
There're some cases that we don't need to make the job persisted and
RECEIVE_BOOT_COMPLETED
permission(Not sure how many but at least in our use case it is). This PR addsjobPersistedEnabled
option as metadata forBeaconService
as follows(defaults to true and it keeps backwards compatibility):~With this change, the flag would be
false
by default and you need to manually add the option to enable the persistent option.~ ~I know breaking backwards compatibility should be avoided and would like to discuss it if you like the idea ๐~Thx in advance!