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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:18:19+00:00 2026-05-26T23:18:19+00:00

I get stuck with something that , I guess , is very trivial. Basically

  • 0

I get stuck with something that , I guess , is very trivial.
Basically I am scheduling alarm for a given moment in the future :

Intent contentIntent = new Intent(this, AlarmReceiver.class); 
PendingIntent theappIntent = PendingIntent.getService(Main.this, 0,contentIntent, 0); 
Calendar calendar = Calendar.getInstance();
calendar.set(year, month, day, hour,minute); 
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), theappIntent); 

works fine while mobile is constantly on.
My problem is that alarm is not triggered after mobile is restarted
and is TURNED ON on the expected time.
Is there something I missed? Should I do some extra work to keep alarm
scheduled after restart?

  • 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-26T23:18:20+00:00Added an answer on May 26, 2026 at 11:18 pm

    You have to reset the alarm when device get boot.
    You are missing to detect the app when device boot and reset the alarm..so below is code written in manifest

    <receiver android:name=".YourReceiver">
                <intent-filter>
                    <action android:name="android.intent.action.BOOT_COMPLETED" />
                </intent-filter>
    </receiver>
    
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    

    Also create a BroadcastReceiver to receive the boot completed intent

     public class YourReceiver extends BroadcastReceiver {
    
    
     Context ct;
    
     @Override
     public void onReceive(Context context, Intent intent) 
     {
        ct=context;
        if(intent.getAction().equals("android.intent.action.BOOT_COMPLETED"))
        {
          // Reset your alarm here
          Intent contentIntent = new Intent(ct, AlarmReceiver.class); 
          PendingIntent theappIntent = PendingIntent.getService(ct, 0,contentIntent, 0); 
          Calendar calendar = Calendar.getInstance();
          calendar.set(year, month, day, hour,minute); 
          AlarmManager am = (AlarmManager) ct.getSystemService(ALARM_SERVICE);
          am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), theappIntent); 
        }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a lot of queries select * from tbl_message that get stuck on
I'm not very good at C, and I always get stuck on simple string
I'm stuck on an aggregation problem that I can't get to the bottom of.
Say you have a method that could potentially get stuck in an endless method-call
I'm stuck in something that I'm sure rather easy I have a field in
I’m stuck on something that I can’t fix by myself :( Unfortunately… I need
Sometimes I still get stuck trying to translate procedural code into functional code. Is
When working on developing new software i normally get stuck with the redundancy vs
I'm stuck trying to get a WinInet HTTP POST via SSL using ONLY C.
I'm stuck trying to get a regex to match a filetype in a sorting

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.