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

  • Home
  • SEARCH
  • 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 9127447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:17:04+00:00 2026-06-17T07:17:04+00:00

Hi friends i have a problem… Actually i use this code to open my

  • 0

Hi friends i have a problem…
Actually i use this code to open my application in certain time..the app is working fine but when the device is in sleep mode not working..??

public class MyBroadCastReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context ctx, Intent intent) {
        Intent intent = new Intent(ctx, ActivityMain.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        ctx.startActivity(intent);
    }

}

ActivityMain.java

intent = new Intent(getBaseContext(), MyBroadCastReceiver.class);

        pendingIntent = PendingIntent.getBroadcast(
                getBaseContext(), REQ_CODE, intent, 0);

        alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
        alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis()
                + (60 * 1000), pendingIntent);

In device sleep mode not working, BroadCastReceiver Calss unable to open the MainActivity class.

I have given permission in menifest

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

Any Help please.

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

    The wake lock of your broadcast receiver is only guaranteed to keep the phone awake for the duration of the onReceive method. If you need to do work beyond that method, you need to aquire/manage another wake lock.

    A Commonsware library exists for this purpose. Have a look at: https://github.com/commonsguy/cwac-wakeful/blob/master/README.markdown

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

Sidebar

Related Questions

I have created an invite friends code, which is properly working if an FB
I have a problem selecting 6 random friends This is the query I've got
I have strange problem. I developed app code signed it with Distribution provisioning profile
I have this problem. I use caliburn micro in WPF. In view I have
i have a problem on my friends server when testing my php code on
I am currently upgrading code for a friends website and have encountered a problem
I am working on an Android sms application. I have a problem with sending
Friends, I have a strange need and cannot think my way through the problem.
I have a working WAMP environment (Apache Friends). I decided to try Subversion and
I have a table called 'friends', this contains the columns person1 and person2 .

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.