I have a background service that runs for a period of about 10 hours. During this period it acquires information from one of the phone's sensors (about 300 TIMES PER SECOND), processes the information, and uploads the processed information to a database file (about every 15 SECONDS).
I have already implemented foreground but the service still shuts down after a few hours.
Before I transferred this process to a service it was in an activity. I had to keep the screen on for 10 hours during the process and it worked with about a 50% drain on battery.
What would be best for performance and then for battery? Implementing WakeLock or AlarmTimer in the background service.
Please don't suggest things like use a power cable because it wouldn't fit the parameters of my app and I really dont need to if I only got a 50% drain on battery with the screen on.
I just need to know what would be the best way to keep the CPU alive so the service doesn't get killed