내 서비스 시작 시간 : 오전 8시. 특정 시간에 서비스를 중지하는 방법을 모르겠습니다.안드로이드에서 특정 시간에 서비스를 중지하는 방법?
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(this, MyService.class);
PendingIntent pi = PendingIntent.getService(this,
(int) System.currentTimeMillis(), intent, 0);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 8);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 24*60*60*1000, pi);
나는 미사를 8시에 시작하고 매일 6시에 중지하고 싶습니다.
도와주세요. 감사.
모든 필요한 정보를 찾을 수 있습니다, 동일한 작업을 수행하지만, 오후 6시 서비스를 중지 할 수 있습니다. – Carnal
http://stackoverflow.com/questions/1877417/how-to-set-a-timer-in-android ..이 링크를 통해 이동하십시오. –