How to show progress in prefrence activity pending intent
I want to do a tas开发者_开发百科k in certain interval automatically.I called the service in pending intent as below
alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
mAlarmSender = PendingIntent.getService(Schedule.this, 0, new Intent(Schedule.this,
Schedule_service.class), 0);
new Thread(new Runnable() {
public void run() {
Schedule.this.finish();
alarmManager.setRepeating(
AlarmManager.RTC_WAKEUP, SysTime,
interval, mAlarmSender);
state = true;
}
}).start();
But there is a blank screen while the service runs and force closes when I press back button.So I tried it in async task also to show progress until the service finish but it also doesnt help.Any solution or guidance please, Thanks.
Intent intent = new Intent(context, reminderService.class);
PendingIntent pendingIntent = PendingIntent.getService(context, 1, intent, 0);
AlarmManager alarmmanager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
alarmmanager.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 1000 * 60 * 60 * 24, pendingIntent);
精彩评论