For your problem, the alarm will be triggered immediately if you set the time in the past
From AlarmManager API documentation:
If the stated trigger time is in the past, the alarm will be triggered immediately, with an alarm count depending on how far in the past the trigger time is relative to the repeat interval.
In this case, you have to check first whether the stored time is in the past. If yes, then you have to add intervals until the time is in the future.
Try changing the code to:
long now = new Date().getTime();
while (time < now) {
time += AlarmManager.INTERVAL_DAY;
}
alarmManager.setRepeating(AlarmManager.RTC, time,
AlarmManager.INTERVAL_DAY, PendingIntent.getBroadcast(this,
alarmUniqueCode, intentAlarm, PendingIntent.FLAG_UPDATE_CURRENT));
Regarding your second question, I cannot really answer. However, based on my self-experience, I don't have any problems even if I leave the receiver on.