My codes
calendar = Calendar.getInstance();
calendar.set(Calendar.MONTH, month);
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.DAY_OF_MONTH, date);
long eventTime=calendar.getTimeInMillis();
long oneDay=AlarmManager.INTERVAL_DAY;
int noOfDays=4;
long reminderTime=eventTime-(noOfDays*oneDay);
Intent myIntent = new Intent(Home.this, MyBroadcast.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(Home.this, 0, myIntent,0);
AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, reminderTime, pendingIntent);
I tried everything but It will ring right on I setting it !
You need to use Gregorian calendar,
Gregorian calender Calendar cur_cal = new GregorianCalendar();
cur_cal.setTimeInMillis(System.currentTimeMillis());
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.