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

The Archive Base Latest Questions

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

I am trying to make my app print something to log when screen is

  • 0

I am trying to make my app print something to log when screen is turned on but it doesn’t work as I expected.

Here is what I have in my Manifest file

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity ...>
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


    <receiver android:name="PhoneBroadcastReceiver" android:enabled="true">
        <intent-filter>
            <action android:name="android.intent.action.SCREEN_ON"></action>
        </intent-filter>
    </receiver>
</application>

and my receiver looks like

public class PhoneBroadcastReceiver extends BroadcastReceiver {

public PhoneBroadcastReceiver()
{
}

@Override
public void onReceive(Context _context, Intent _intent) {
    // TODO Auto-generated method stub
    String a = _intent.getAction();


    MessageHandler.log("Received action: " + a); // just a wrapper for printing to a log

}

}

but it prints nothing to the log. I keep pressing my Android power button and the screen turns on / turns off but my message doesn’t appear in the log. What am I missing? It looks the same as in examples I found on the web.

  • 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:58:24+00:00Added an answer on May 23, 2026 at 5:58 pm

    You cannot listen for ACTION_SCREEN_ON broadcasts via a BroadcastReceiver registered in the manifest. You have to register it via registerReceiver() from a running component. There are fairly few broadcasts with this trait (ACTION_SCREEN_OFF, ACTION_BATTERY_CHANGED, and perhaps ACTION_USER_PRESENT).

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

Sidebar

Related Questions

I have an app with tabbar and webview. I'm trying to make the app
I'm trying to make a simple drawing app in c++, but i'm having trouble
I am trying to make Twitter work in my app and everything works fine
I have been trying to make a layout for an Android app that functions
I am trying to make my app localized. I have followed this procedure http://www.switchonthecode.com/tutorials/a-simple-localization-example-for-the-iphone
I'm trying to make my app a good Windows citizen, so I use matching
I am trying to make an app that will pass data between two servers
I'm trying to make my app publish to all my friend's walls. From what
I am trying to make a web app in Dashcode that uses a range
I'm trying to make a console app that would monitor some process and restart

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.