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 6551337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:19:34+00:00 2026-05-25T12:19:34+00:00

I have some activities in my application. In main activity I have defined the

  • 0

I have some activities in my application. In main activity I have defined the wake lock:

PowerManager powerManager = (PowerManager)getSystemService(Context.POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "My Lock");

and released it in onPause() method. My question is, is it active in the whole of application? or Do I need to copy/paste it in each activity that I have?

Thanks

  • 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-25T12:19:35+00:00Added an answer on May 25, 2026 at 12:19 pm

    As long as WakeLock is acquired, so long wake lock is held. Related is lifetime of your WakeLock object. And if WakeLock is no more used and it is GC’d while still having lock, it’s released during garbage collection (in finalize() method).

    So your wake lock is active between acquire() and release(). You must make sure that your code calls these functions when needed from desired activities.

    If you want WakeLock globally in your application, extend android.app.Application, specify it in manifest, and manage wake lock on application level.

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

Sidebar

Related Questions

I have three activities 1 is the main activity 2 is some other activity
I have an Android application with a main activity that is the tabhost. I'm
I have an application that contains a main Activity, which has a very simple
I have two activities, one is main and I have another activity called Test
Ive got two activities in the same application. the first one is with gui(main
In my android application, I create shortcuts by code to some activities within my
My application's main Activity is a TabActivity and it contains an OptionsMenu. I define
In my application I'm using some activities that can run each other. On resume
i am building an android application but i have some questions about the memory
I have an Android App with a number of activities. The wrong activity is

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.