IF as mark told u need to use an alarm manager class,here is an example: Intent alrm_intent=new Intent(this,alarmreceiver.class); /*alarmreceiver.class-->this is another class which receives the alarm broadcast which we are going to broadcast*/ AlarmManager alm=(AlarmManager)getSystemService(ALARM_SERVICE); PendingIntent alrm_pending=PendingIntent.getBroadcast(this,0 , alrm_intent, 0); /****i assume you are using a time picker to get the time when the alarm should go off.The next few lines calculate the time which is left for alarm to fire in milliseconds****/ Calendar alrm_cal=Calendar.getInstance(); alrm_cal.setTimeInMillis(System.currentTimeMillis()); alrm_cal.set(alrm_cal.get(Calendar.YEAR), alrm_cal.get (Calendar.MONTH), alrm_cal.get(Calendar.DAY_OF_MONTH), alhr, almin); /**alhr-->hour in which alarm should fire almin-->minute in which alarm should fire**/ long diff_inmillis=alrm_cal.getTimeInMillis()- System.currentTimeMillis(); //now set the alarm using alarm manager alm.set(AlarmManager.RTC_WAKEUP,System.currentTimeMillis() +diff_inmillis ,alrm_pending);
Now alarm receiver class should be something like this--> public class alarmreceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { /*****DO WHAT EVER YOU WANT TO DO HERE THIS METHOD WILL GET CALLED WHEN THE ALARM IS FIRED!****/ } } one more step-->you have to register the receiver in the manifest file like this <receiver android:name="alarmreceiver" android:process=":remote"/> inside the application tag itself Regards Gino On Jan 10, 4:15 pm, Ali Murtaza <mralimurt...@gmail.com> wrote: > hi > Can anyone tell how to set alarm using my application.. give me the > refference of the API > > -- > Ali Murtaza > > BCSF06M021 > Research Assistant > Data Virtulization Ware House > PUCIT, Lahore, Pakistan > ali.murt...@pucit.edu.pk
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en