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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:45:12+00:00 2026-05-29T22:45:12+00:00

When setting a service to go off at particular time, I use the AlarmManager

  • 0

When setting a service to go off at particular time, I use the AlarmManager system service.
Everything goes off without a problem, service is called and actions take place.

When the alarm time is reached, the service starts, and at this point I get the system time (System.currentTimeMillis()). I’m guessing this wont be the actual time the service start. Is there a way to get the time that was set for this PendingIntent?

ie

Set alarm for 9am.
DoStuffService starts at 9am.
DoStuffService knows it was supposed to start at 9am, and uses this value for future functions.

  • 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-29T22:45:13+00:00Added an answer on May 29, 2026 at 10:45 pm

    When you create an intent for your alarm, you could put extra data, including time of the alarm, into it like this:

    Intent intent = new Intent("action name");
    
    //put extra data into the intent:
    intent.putExtra("alarm_time_hours", hours);
    intent.putExtra("alarm_time_minutes", minutes);
    
    PendingIntent sender = PendingIntent.getBroadcast(getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
    am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), sender);
    

    Then in your receiver or service you need to get this extra data from received intent. Use something like this:

    Bundle bundle = intent.getExtras();
    if(bundle.containsKey("alarm_time_hours")) {
        int hours = bundle.getInt("alarm_time_hours");
    }
    if(bundle.containsKey("alarm_time_minutes")) {
        int minutes = bundle.getInt("alarm_time_minutes");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Android's AlarmManager Javadoc states When an alarm goes off, the Intent that had been
I am working on setting up my report server to use a web service
I'm curious to know how I would go about setting up my service to
I'm setting up a notification service using ActiveMQ, in C#. My ActiveMQ topology is
I'm setting up a net.tcp WCF service using instructions here: http://blogs.msdn.com/swiss_dpe_team/archive/2008/02/08/iis-7-support-for-non-http-protocols.aspx One of the
I'm setting a custom StatusDescription in a RESTful WCF service when an exception is
Good Day Everyone... Apparently, I'm not setting-up impersonation correctly for my WCF service. I
I'm attempting to change the screen brightness from withing a service, like so: android.provider.Settings.System.putInt(getContentResolver(),
if location services are turned off (after the user once did allow the service)
I am facing a peculiar problem related to a hosted WCF service (.NET Framework

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.