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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:01:19+00:00 2026-05-28T20:01:19+00:00

I need a command that can perform something, lets say on 7:00 AM every

  • 0

I need a command that can perform something, lets say on 7:00 AM every day.

Is it possible?

I would appreciate if you could give me some code samples

Thank you!

  • 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-28T20:01:20+00:00Added an answer on May 28, 2026 at 8:01 pm

    Yes, you need the AlarmManager class, you create an intent and a calendar object (set to the time you want), then use AlarmManager to run the intent at that time (using setRepeating to make it repeat every day)

    Intent intent = new Intent(getBaseContext(),
                                    some_service.class);
                            PendingIntent pendingIntent = PendingIntent
                                    .getService(getBaseContext(), 0, intent, 0);
    
    
                            AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
                            // Cancel all previous alarms of the same type
                            alarmManager.cancel(pendingIntent);
    
    
                            Calendar calendar = Calendar.getInstance();
                            Calendar currentDate = Calendar.getInstance();
    
                            calendar.add(Calendar.HOUR, 24);
                            calendar.set(Calendar.HOUR_OF_DAY, 07);
                            calendar.set(Calendar.MINUTE, 00);
                            calendar.set(Calendar.SECOND, 00);
    
                            // Set alarm manager to run at selected time
                            // each day
                            alarmManager.setRepeating(AlarmManager.RTC,
                                    calendar.getTimeInMillis(),
                                    AlarmManager.INTERVAL_DAY, pendingIntent);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to locate a command line tool that would allow me to write
I need a shell command or script that converts a Unix timestamp to a
I need to write a Red Hat Linux command line tool that launches a
I need a doc to rtf converter that will run from the command line,
I need to pass -Dlog4j.debug to tomcat through command line, how to do that
I have a class that can perform many types of transformations to a given
I need to write an app on Mac OS X that would send remote
I have a small script that launches and, every half hour, feeds a command
I have a list/queue of 200 commands that I need to run in a
I need a command to replace the hosts file on my machine. Seems pretty

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.