I have a date from DatePicker in int year; int month; int day;
int year; int month; int day;
and time from TimePicker in int hour; int minutes;
int hour; int minutes;
. I need to create new alarm for this date, with notification. How I can do this?
I Have code :
public void addNotify(){
AlarmManager alarmManager = (AlarmManager) this.getSystemService(ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(year1, month1, day1, hour, minut);
Intent intent = new Intent(this, NotificationService.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
}
As @Prmths said you probably haven't read anything on how to do that.
Have a look to the 'AlarmManager' class: link and with a bit of Google searching you should be able to achieve what you want to do.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.