I need a little bit of help. I have a Database with two colloms, Name and Time. The time is filled with a time that the user picks and then all is saved.
I need the alarm to go off everyday at that spefic time but dont have a clue how to go about it. I have a BroadcastReciver and a service rubbing but dont know where to start.
How would I go about getting the information from the Database then setting an alarm?
I have tried the following but nothing happens...
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
Intent myIntent = new Intent(Meds2.this , AlarmReceiver.class);
AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
PendingIntent pendingIntent = PendingIntent.getService(Meds2.this, 0, myIntent, 0);
calendar.set(Calendar.HOUR_OF_DAY, hourr);
calendar.set(Calendar.MINUTE, minutes);
calendar.set(Calendar.SECOND, 00);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 24*60*60*1000 , pendingIntent); //set repeating every 24 hours
Aucun commentaire:
Enregistrer un commentaire