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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:08:06+00:00 2026-06-13T07:08:06+00:00

I have a requirement to start an activity when the screen is idle after

  • 0

I have a requirement to start an activity when the screen is idle after a certain time. I have established the best way is to create a custom broadcastReceiver which looks for the Intent.SCREEN_OFF intent and override it.

Inside this custom broadcastReceiver, I’m starting the Activity. It works the first time the screen goes off, but it doesn’t work again until the app is uninstalled and reinstalled.

I’m getting the following error:

android.content.ActivityNotFoundException: Unable to find explicit activity class {/}; have you declared this activity in your AndroidManifest.xml?

To answer this rather obvious question, yes. I have.

<activity
        android:name="gold.KioskPlayer"
        android:configChanges="orientation|keyboardHidden"
        android:enabled="true"
         android:launchMode="singleInstance"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

It works from another Activity fine. Furthermore, if the Manifest was wrong, then it wouldn’t work full stop.

As Todd has suggested, “The error makes it sound like it somehow loses track of what Activity is supposed to be called.” How is this possible? Is it a bug?

So, here’s the broadcastReceiver code:

BroadcastReceiver screenoff = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {

        Log.d("ScreenSaver", "ScreenSaver1 - ScreenOff");
        //Log.d("Power Lock Pressed",   "Power Button Off Pressed:" + intent.getAction());
        if(!setup.screensaverShown || !setup.canSleep)
        {
            releaseWakeLock();
            try {
                setup.wl = setup.pm.newWakeLock(
                           PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP,
                           "ScreenSaver");
                setup.wl.acquire();
                Thread.sleep(100);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            try{
                KioskPlayer.setup.screensaver=true;
                Log.d("ScreenSaver", "ScreenSaver1 starting...");
                Intent i = new Intent(getBaseContext(), KioskPlayer.class);
                i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                getApplication().startActivity(i);
            }catch(Exception e)
            {
                Log.d("ScreenSaver", "ScreenSaver1 " + e.toString());
            }
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }
};


BroadcastReceiver screenon = new BroadcastReceiver() {

    @Override
    public void onReceive(Context context, Intent intent) {
        if(setup.canSleep)
        {
            setup.canSleep=false;
        }

    }

};


public void releaseWakeLock(){
    try {
        if ( setup.wl != null && setup.wl.isHeld() )
        {
            setup.wl.release();
            setup.wl = null;
        }
    }catch(Exception e){}
}

I can call the Activity from another Activity fine. I can even call it from this Service fine, but once and once only before it gets that error.

Help will be greatly appreciated!

  • 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-13T07:08:07+00:00Added an answer on June 13, 2026 at 7:08 am

    Turns out it was because I was disabling the class component, which meant it could only be launched by the app itself.

    This certainly answers Todd’s question: “The error makes it sound like it somehow loses track of what Activity is supposed to be called.” I had disabled it programatically, so it could no longer be found by the system.

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

Sidebar

Related Questions

I have a requirement to start my application at certain time. I don’t want
I have a requirement to calculate summary statistics aggregated by specific custom time periods.
In our project we have requirement that, after receiving sms message from third party
I have a requirement that regardless of the start and dates that I need
What is the minimum memory requirement to start JVM? I have the cheapest VPS
I have a requirement for users to create, modify and delete their own articles.
I have a requirement of getting a full screen image on clicking the tagged
I have a requirement to write a stored procedure that accepts a start date,
I have a requirement that goes as follows (trust me, I'm way too old
I have a requirement to start up the browser of an E-Ink Nook and

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.