how to set alarm to repeat monthly
-
Hi Currently I am working on an application to set reminders on monthly basis. I am not able to provide the correct repeating interval for my alarmmanager. Pls provide info about the same. this is my code, but this will not raise alarm for Feb or months having 30 days. Also pls provide code to set yearly repeating alaram. repeatTime=(AlarmManager.INTERVAL_DAY*31); mAlarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, when.getTimeInMillis(), repeatTime, pi); Thanks, Sharath
-
Hi Currently I am working on an application to set reminders on monthly basis. I am not able to provide the correct repeating interval for my alarmmanager. Pls provide info about the same. this is my code, but this will not raise alarm for Feb or months having 30 days. Also pls provide code to set yearly repeating alaram. repeatTime=(AlarmManager.INTERVAL_DAY*31); mAlarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, when.getTimeInMillis(), repeatTime, pi); Thanks, Sharath
-
Hi Currently I am working on an application to set reminders on monthly basis. I am not able to provide the correct repeating interval for my alarmmanager. Pls provide info about the same. this is my code, but this will not raise alarm for Feb or months having 30 days. Also pls provide code to set yearly repeating alaram. repeatTime=(AlarmManager.INTERVAL_DAY*31); mAlarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, when.getTimeInMillis(), repeatTime, pi); Thanks, Sharath
As you are already (hopefully) aware, hard-coding numbers into your code is a bad idea. When are you wanting the alarm set for (e.g., the last day of the month)?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
Hi Currently I am working on an application to set reminders on monthly basis. I am not able to provide the correct repeating interval for my alarmmanager. Pls provide info about the same. this is my code, but this will not raise alarm for Feb or months having 30 days. Also pls provide code to set yearly repeating alaram. repeatTime=(AlarmManager.INTERVAL_DAY*31); mAlarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, when.getTimeInMillis(), repeatTime, pi); Thanks, Sharath
Hey, I tried this code in my app.In this app multiple alarms were set with different repeating time intervals. I used calendar object to add month and year accordingly and again set it for next alarm.i used code like this(for scheduling it for next month)- PendingIntentsender=PendingIntent.getBroadcast(context,Integer.parseInt(Long.toString(id)), intent1, 0); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(calendar.getTimeInMillis()); calendar.add(Calendar.SECOND, 30); AlarmManager am = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); calendar.add(Calendar.MONTH, 1); am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender); Hope this works!