1. Are you ready for the Galaxy S20? Here is everything we know so far!

Android: advice on method to wake up CPU from sleep, carry out a task then go back to sleep

Discussion in 'Android Development' started by katesfb, Jun 28, 2021.

  1. katesfb

    katesfb Lurker
    Thread Starter

    Hi, I have created a time lapse camera app that collects images during daylight hours and uploads those images to an FTP server. I now need to add a method to prolong battery life by putting the cpu to sleep at night, wake it up in the morning, collect and image, then go back to sleep in-between image collections (15 - 20 mins). The code i have used so far is based on the processing IDE with some android based java as well where necessary.

    I have tried using wake-locks which didn't seem to work and have had a look at the AlarmManager class which might be the way to go but my programming skills aren't great. The AlarmManager class had an example that (i think) could wake the cpu at a given time then use the setRepeating method to wake up the device every x minutes after that. Is this correct? However i need it to stop doing that at night and repeat the next day(s) which adds another layer of complexity.

    Any advice on this and/or example code to get me started would be much appreciated.

    Cheers
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...
Similar Threads - Android advice method
  1. xaphar
    Replies:
    4
    Views:
    94
  2. mysorian
    Replies:
    0
    Views:
    184
  3. svim
    Replies:
    4
    Views:
    252
  4. BirchyCalling
    Replies:
    3
    Views:
    227
  5. mysorian
    Replies:
    0
    Views:
    272
  6. kumaranil13k
    Replies:
    7
    Views:
    332
  7. Triciaboyd
    Replies:
    0
    Views:
    230
  8. avneetahuja7
    Replies:
    1
    Views:
    312
  9. AmandaxD
    Replies:
    3
    Views:
    3,707

Share This Page

Loading...