Repeat Alarms Every Monday in Android

This is a discussion on Repeat Alarms Every Monday in Android within the Android Forum forums, part of the Android Discussions category; I want to repeat my task on every Monday at 09:00AM & 05:00 PM. I used following code for that but i am not able ...

Results 1 to 2 of 2

Thread: Repeat Alarms Every Monday in Android

  1. #1
    Android Lurker keyuraashra's Avatar
    Join Date
    Jun 2012
    Location
    Ahmedabad, India
    Posts
    1

    Question Repeat Alarms Every Monday in Android

    I want to repeat my task on every Monday at 09:00AM & 05:00 PM. I used following code for that but i am not able to repeat the task.

    Activity Code :-
    publicclassAndroidScheduledActivityextendsActivity{
    /** Called when the activity is first created. */
    int id =115;
    Intent myIntent;
    PendingIntent pendingIntent;
    AlarmManager alarmManager;
    @Override
    publicvoid onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView
    (R.layout.main);
    Button buttonStart =(Button)findViewById(R.id.start);

    myIntent
    =newIntent(getBaseContext(),MyScheduledReceiver.class);
    myIntent
    .putExtra("id", id);
    pendingIntent
    =PendingIntent.getBroadcast(getBaseContext(), id, myIntent,0);

    alarmManager
    =(AlarmManager)getSystemService(ALARM_SERVICE);

    buttonStart
    .setOnClickListener(newButton.OnClickListener(){
    publicvoid onClick(View arg0){
    // TODO Auto-generated method stub
    setForMonday
    ();
    finish
    ();
    }});
    }

    publicvoid setForMonday(){
    Calendar calendar =Calendar.getInstance();


    calendar
    .set(Calendar.DAY_OF_WEEK,2);
    calendar
    .set(Calendar.HOUR,09);
    calendar
    .set(Calendar.MINUTE,00);
    calendar
    .set(Calendar.SECOND,0);
    calendar
    .set(Calendar.MILLISECOND,0);
    System.out.println("Old is set@ :== "+ calendar.getTime());


    long interval = calendar.getTimeInMillis()+604800000L;
    System.out.println("Next Millis = "+ interval);
    alarmManager
    .setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), interval, pendingIntent);
    }
    }




    Note :- I counted interval based on 86400000 * 7 = 604800000;Receiver :-
    publicclassMyScheduledReceiverextendsBroadcastReceiver{

    @Override
    publicvoid onReceive(Context context,Intent intent){
    // TODO Auto-generated method stub

    System.out.println("Receiver");
    }

    }
    If anyone has any idea please kindly help. Thanks

  2. Android.net is the premier Android Forum. Registered users do not see these ads. .

  3. #2
    Super Moderator RobKort's Avatar
    Join Date
    Apr 2012
    Location
    Pennsylvania, US
    Posts
    630
    Thanked
    75 times
    Are we taking about setting an alarm clock here? What track exactly are you talking about?

    -end of line-



Remove Ads

http://www.scramblerducati.org/

Sponsored Links

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Similar Threads

  1. Many 4G Phones will be FREE on Monday at Amazon
    By wicked in forum Android News
    Replies: 2
    Last Post: 05-27-2011, 07:43 PM
  2. More HTC Calendar Repeat Choices?
    By gw.hicks in forum HTC EVO 4G Tech Support
    Replies: 2
    Last Post: 10-03-2010, 07:10 PM

Search tags for this page

alarm set for monday in android

,
android alarm repeat
,
android alarm start at every monday
,
android calendar alarm repeat
,

android calendar repeat alarm

,
android calendar.monday
,
android repeat monday calendar
,
android: alarm repeat code
,
faceniff
,
how to play repeat alarm sunday monday in android
,
how to repeat a service every week android
,
repeat alarm every minute with intervals hours in android
,
schedule alarm by weekday android code
,
set alarms in android code
,
set repeating alarm android
Click on a term to search our sites for related topics.
Android Forum