covidsafe / App-Android

Doctors and researchers at the University of Washington with Microsoft volunteers have built a tool to alert you about highly relevant public health announcements, potential exposure to COVID-19, and to assist public health officials and contact tracing teams without compromising your personal privacy.
http://covidsafe.cs.washington.edu/
MIT License
65 stars 20 forks source link

Pull Service to be moved to Work Manager instead of Intent Service #58

Closed aakash1313 closed 4 years ago

aakash1313 commented 4 years ago

@justinklchan : Do we want this service to be always running in background?

justinklchan commented 4 years ago

The Service encapsulates two tasks: The PullFromServerTask which runs once an hour (this polls server for exposure notifications + narrowcast messages) The LogPurgerTask which runs once a day (deletes old data, so we only retain latest 14 days of data)

I am guessing you need a service constantly running for this to happen. But if you know of other ways to do this that is less power hungry, please post them.

aakash1313 commented 4 years ago

@justinklchan : I think it seems to be a deferrable task, how about if we let work manager perform it for us. It will take care of the battery constraints and other constraints for us. Since this doesn't require to be run continuously (like location logging ), as a best practice for background process, work manager will handle it efficiently for us.

Let me know what you think about it?

image

justinklchan commented 4 years ago

This seems good, just read a little about WorkManager. As long as you can set the constraint to run at particular time intervals (doesn't have to be exact), that is fine. For example for the Pull task we can check for network connectivity. And also check for low battery for both tasks. Please add it.

aakash1313 commented 4 years ago

@justinklchan : This is done, should we close this?

justinklchan commented 4 years ago

let me verify