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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:30:07+00:00 2026-06-18T00:30:07+00:00

I have tried several published solutions to try and turn the screen off in

  • 0

I have tried several published solutions to try and turn the screen off in android, including:

getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

Which results in no change.

WindowManager.LayoutParams param = getWindow().getAttributes();
param.screenBrightness = 0;
param.flags |= LayoutParams.FLAG_KEEP_SCREEN_ON;
getWindow().setAttributes(param);

Which results in a slightly dimmed screen (on Android 4.2.1)

//Release all previously held WakeLocks
if (mWakeLock.isHeld()) {
    mWakeLock.release();
}
//Then acquire a partial wake lock (which should allow the display to turn off)
PowerManager powerMan = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE);
mWakeLock = powerMan.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Partial WakeLock");
mWakeLock.acquire();

Which results in no change.

And finally, the illegal

PowerManager powerMan = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE);
powerMan.goToSleep(1000);

which clearly doesn’t work because:

<uses-permission android:name="android.permission.DEVICE_POWER" />

is not permissible (to non-system apps).

I am assuming these problems are because my app is android:theme="@style/FullscreenTheme".

Are there any workable solutions to allow a fullscreen app to go to sleep without sacrificing the wonderful fullscreen theme?

  • 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-06-18T00:30:09+00:00Added an answer on June 18, 2026 at 12:30 am

    After writing a simple answer to try and post to @CommonsWare, I found that the problem didn’t persist.

    I combed through my code several times, and still didn’t find anything which would cause the screen to stay awake. I rewrote the entire app from scratch (always a good exercise, ending up with much cleaner logic), and the problem disappeared.

    Lesson learnt – if all else fails, re-write everything again. It’s a useful exercise in itself 🙂

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

Sidebar

Related Questions

I have tried several of the solutions I have seen out here, but am
I have tried several solutions and the result of parsing JSON with GSON always
I'm quite new to android, but I have already created several apps and published,
I have tried several solutions to replace a , with aeither <br /> or
I have tried several solutions I found on github (like rolling back to rake
I have tried several mySQL queries to compare a column of dates stored as
I have tried several things so far, but I haven't had much luck yet.
I have tried several ways to login to a website through java. I have
Here is what I have. I have tried several things but I can't figure
I am stumped by this one. I have tried several angles and some come

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.