how to set alarm for my Database Values?
I am trying to set alarm for my database values. In database i am saving 4 values alarm1, alarm2, alarm3, alarm4 in a sin开发者_Go百科gle row. I need to set alarm for those 4 values. How can i set alarm for my application. Please any one help me. Below is the code for setting alarm.
Intent myIntent = new Intent(this, MyAlarmService.class);
pendingIntent = PendingIntent.getService(this, (int) System.currentTimeMillis(), myIntent, 0);
AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, hour1);
calendar.set(Calendar.MINUTE, min1);
calendar.set(Calendar.SECOND, 0);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 24*60*60*1000, pendingIntent);
Toast.makeText(this, "Start Daily Alarm", Toast.LENGTH_LONG).show();
How are you saving the alarms in DB if you are saving in DB as Strings you need to retrieve those values and need to convert those values to date formats and then you have to use push notifications similar in iphone
精彩评论