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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:08:50+00:00 2026-06-06T06:08:50+00:00

Currently I am working on BroadcastReceiver, Service & AlarmManager in Android to developed one

  • 0

Currently I am working on BroadcastReceiver, Service & AlarmManager in Android to developed one of functionality in my project. I need to schedule some task at particular time on particular day.

For E.g :-

Monday – 09:00 AM & 05:00 PM

Tuesday – 09:00 AM & 05:00 PM

Wednesday – 09:00 AM & 05:00 PM

Thursday – 09:00 AM & 05:00 PM

Friday – 09:00 AM & 05:00 PM

Saturday – 10:00 AM & 10:00 PM

Sunday – 10:00 AM & 10:00 PM


What i have done till now is created one activity & broadcastreceiver. On click of button, after every 60seconds broadcast receiver will be called. Here is my code snippet. But i want to schedule my task according to the week that i have described above. Can anyone please kindly help me how can i schedule the task like above.

Code :-

public class AlarmDemoActivity extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Button buttonStart = (Button)findViewById(R.id.start);
        buttonStart.setOnClickListener(new Button.OnClickListener(){

            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                Intent myIntent = new Intent(getBaseContext(),
                        MyScheduledReceiver.class);

                PendingIntent pendingIntent
                = PendingIntent.getBroadcast(getBaseContext(),
                        0, myIntent, 0);

                AlarmManager alarmManager
                = (AlarmManager)getSystemService(ALARM_SERVICE);
                Calendar calendar = Calendar.getInstance();
                calendar.setTimeInMillis(System.currentTimeMillis());
                calendar.add(Calendar.SECOND, 10);
                long interval = 60 * 1000; //
                alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
                        calendar.getTimeInMillis(), interval, pendingIntent);
                finish();
            }});
    }
}

BroadcastReceiver :-

public class MyScheduledReceiver extends BroadcastReceiver{

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub
        /*Intent scheduledIntent = new Intent(context, MyScheduledActivity.class);
        scheduledIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(scheduledIntent);*/

        System.out.println("Make Phone Silent");
    }

}

All suggestion and tips are welcomed.

  • 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-06T06:08:52+00:00Added an answer on June 6, 2026 at 6:08 am

    I will give the idea for this at a very high level.You will have to figure out the coding your self:

    1.Save the user preferences in shared preferences(which I presume you are already doing)

    2.Schedule the first alarm using the set method of Alarm Manager
    Refer this for details on this method.

    3.When that alarm goes off,again schedule the next alarm using the next time period in Shared Preferences,again using the set method

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

Sidebar

Related Questions

Currently working on database part of android project. The main aim of the project
Im currently working on a project that requires the following. I need to be
Currently working on a project that is being developed in VS2010. I'm running Windows
I'm currently working on an ASP.NET MVC project using NHibernate and I need to
Currently working on a project where we need to drop in various static html
Currently working on a VBScript to automate some of the dirty PST ingestion work
Currently working on something which uses ajax for some pagination. What I'm looking to
Im currently working on a Python/Pygame module to wrap some basic sprite animation. Animation
I am currently working on a project and my goal is to locate text
Currently working with Oracle, but will also need a solution for MS SQL. I

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.