I am setting alarm manager by this method:
public void setAlarmManager(Context context, Intent intent, long repeat) {
PendingIntent pendingIntent;
pendingIntent = PendingIntent.getService(context, 0, intent, 0);
AlarmManager alarmManager = (AlarmManager) context
.getSystemService(context.ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.SECOND, 10);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
calendar.getTimeInMillis(), repeat, pendingIntent);
}
by this method i am sending sms in a specific number after a fixed amount of time.But this method doesn’t remain consistent.Specially when the goes to sleep mode it doesn’t work.how can i make this continous that it will also work in sleep mode?
AlarmManagerwith a_WAKEUPalarm only guarantees that it will keep the device awake if you use agetBroadcast()PendingIntent.If your work will take only a handful of milliseconds, switch your
Serviceto aBroadcastReceiver.If your work will take more than a few milliseconds, consider using my
WakefulIntentService, which offers a pattern for allowing_WAKEUPalarms to reliably get their work done.