In accordance with forum etiquette I did previously post this on SO, but 
I'd like to get a few more advanced Android developer thoughts.

I have a background service that runs all the time when screen is on, and 
every minute records the cycle time and whether it was a good or bad cycle. 

At the end of each day I take these counts of good and bad intervals and 
record it to a csv file.

For visual people like me:
           <--------------------------THE DAY --------------------->
minutes:      1m    1m    1m    1m    1m    1m    1m     1m   1m  
           |-----|-----|-----|-----|-----|-----|-----|-----|-----|Record    
good  bad   good  good  good  bad   bad  good   bad   bad 

                                                            
Currently I use *SharedPreferences *to store the good/bad count throughout 
the day, and write it to a file at the end of the day, but am becoming 
increasingly worried about the persistence of this (to my understanding) 
cached data [I also feel like I may be stretching it's or. 

I'm trying to decide between the following designs: 

*1. File Based:*
Use two temporary files (good interval, bad interval time), which I read 
and write values from at the end of each interval

File Based is simple and straight forward, but opening and closing streams 
every minute could be heavy.


*2. SQLite:*

Create a database with entries representing each day, and consistently 
update the entries after each interval end. 


SQLite would make things cleaner and feel like hacky, but I'm worried about 
the heaviness of keeping a DB connection open all the time and making 
write/read calls every minute


*From a battery performance perspective, which design choice is most 
optimal for ~500-5000 actions daily and why?*

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/3c2705eb-2da9-4fba-8f45-c6c8c1eebcb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to