I am trying to run service on every day only on Specific time, lets say every day 8 :00 am and here I found two methods as
public static void setScheduleMes
Have a look Alarms
@ RTC examples
// Set the alarm to start at approximately 2:00 p.m.
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.set(Calendar.HOUR_OF_DAY, 14);
// With setInexactRepeating(), you have to use one of the AlarmManager interval
// constants--in this case, AlarmManager.INTERVAL_DAY.
alarmMgr.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
AlarmManager.INTERVAL_DAY, alarmIntent);
or
In your code
alarm.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
AlarmManager.INTERVAL_DAY, pintent);
replace
AlarmManager.INTERVAL_DAY
to
24 * 60 * 60 * 1000
. which means repeat alarm exactly after 24 hours