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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:37:25+00:00 2026-05-23T17:37:25+00:00

How to find whether phone is in sleep/idle mode for Android? My problem is

  • 0

How to find whether phone is in sleep/idle mode for Android?

My problem is I am able to wake up the phone from sleepmode by using alarm manager

But when the phone is not sleep mode and at the same instant if Alarm manager is used to wake the phone..android force closes the App..

whether there is anyway to find whether the Phone is in sleep or idle mode?(Black screen)

Update:

My requirement:

When the phone is in sleep mode —> Intent should be launched from the service
When the phone is not in sleep mode –> The same Intent should be launched from the service

None of the solutions below worked perfectly so here is my little tweak which worked perfectly :):)

  //Pending intent for my alarm manager 
  Intent intentaa=new Intent(this,MyBroadcastReceiver.class);
  PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intentaa, 0);

  //Intent to be launched where MyIntent is the intent
  Intent intenta = new Intent();
  intenta.setClass(this, MyIntent.class);
  intenta.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

  //Real code
  try
  {
   startActivity(intenta); 

  }catch(Exception E)
  {

      AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
      am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,SystemClock.elapsedRealtime(),
      pendingIntent);
      startActivity(intenta); 

   }    
  • 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-23T17:37:25+00:00Added an answer on May 23, 2026 at 5:37 pm

    You can check if the screen is turned off by calling isScreenOn method.

    Note:This only can be used for 2.1 and above..

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

Sidebar

Related Questions

I would like to know how to find whether an Android stack in phone
Is there anyway from a C prog to find whether the OS is currently
I am using UICatalog example and trying to find whether it is possible to
How do I find out whether or not Caps Lock is activated, using VB.NET?
I need to find whether using * or select only the fields you want
As the title says, I'd like to be able to find whether an APK
find whether there is a loop in a linked list. Do you have other
I need to find whether the user clicking the browser back button or Refresh
I need to find whether the web page is cached or not. That s
How can I find whether a singly linked list is circular/cyclic or not? I

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.