I want to show a notification at a specific date and I use Calendar object:
Calendar calendar = Calendar.getInstance();
calendar.set(Year, Month, Day, Hours, Minutes, Seconds);
long when = calendar.getTimeInMillis();
And I use a AlarmManager:
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
Intent i = new Intent(this, NotificationsService.class);
PendingIntent pi = PendingIntent.getService(this, 0, i, 0);
am.cancel(pi);
am.set(AlarmManager.RTC_WAKEUP, when, pi);
But this not show a correct miliseconds, if I use:
am.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 10000, pi);
Show correct notification, but if I use a when flag not show a correct miliseconds to notification. Why? Someone help me please. thanks
Edit: (Solve problem)
The problem was that the Month in Calendar is previous at actual (January = 0, February = 1, ...)