Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4047534
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:42:08+00:00 2026-05-20T13:42:08+00:00

I want to take pictures from the Android device’s camera periodically over a matter

  • 0

I want to take pictures from the Android device’s camera periodically over a matter of hours, to create a time lapse video effect.

I set an Alarm Manager with an AlarmManager.RTC_WAKEUP flag set to start up a service every few minutes.

The service holds a partial wakelock, does some work, and then calls a Broadcast Receiver through the Alarm Manager which starts up an Activity.

The activity is created (or is resumed), turns on it’s own wakelock, and sets up the camera preview surface. Once the surface is setup the SurfaceHolder listener’s surfaceChanged() method is called, which finally takes a picture.

If the device is awake, everything works perfectly as expected. But if the device is asleep, once the Activity’s onResume() method is finished the Activity is instantly paused. The camera’s preview surface never finishes initializing, and no picture will ever be taken.

So the questions I have are:

  1. Is there any way to wake up the phone programmatically? I even try using:

    PowerManager powerManager =
                (PowerManager)this.getSystemService(Context.POWER_SERVICE);
    powerManager.userActivity(SystemClock.currentThreadTimeMillis(),false);
    

But that doesn’t wake up the phone if it is asleep.

  1. Is there any way to take a picture without using a preview surface view?

  2. Is there a way to take a picture that doesn’t rely on asynchronous callbacks? Can I put all the code in the Activities onResume() method to take a picture?

  3. Is there any way to keep the Activity’s onResume() method running long enough so that the camera’s preview has enough time to initialize and call all the listeners?

I am using the wakelocks correctly, and I have all the permission’s set properly in the manifest file. My activity isn’t kept awake long enough for the asynchronous listeners to properly work.

And to compound the issue, I’m trying to keep everything Android 1.6 compatible, because that is the only test device I have access to.

This is frustrating stuff!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T13:42:09+00:00Added an answer on May 20, 2026 at 1:42 pm

    I have finally gotten somewhere now.

    I have to create a wakelock using these two flags

    PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ACQUIRE_CAUSES_WAKEUP
    
    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ACQUIRE_CAUSES_WAKEUP, "bbbb");
    wl.acquire();
    

    Then the device wakes up, and starts at the keyguard screen.

    But the only way I can get past the keyguard screen and take a picture is to use these flags on the Activity’s window:

        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN
        | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
        | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
    

    But this is only available with Android 2.0, and doesn’t work in 1.6.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In iPhone Apps, I want to take pictures from Camera & save into Photo
I want to create an Android app where I can take a picture from
in my Activity, i want to take a picture with android.hardware.Camera. The code (see
I have a BlackBerry application that needs to take pictures from the camera and
I am try ing to take multiple pictures with iphone camera from the same
I want to take a picture from the android emulator through my application when
I want to help user to take their pictures with a plugged in video
I want my Android app to take a picture, as part of something larger
I want to take an image from the UIImagePickerController and put it on a
I have a camera preview that I have successfully been able to take pictures

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.