안녕하세요. 내 코드으로 내 애플리케이션에서 alarm
을 시작하십시오. 위의 코드 내 과소에서지정된 요일 이후에 알람 시작
public static void startReferAlarm(Context context,String[] message,String activityToOpen)
{
try {
Log.d("Refer friend Activity", "Alarm On");
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 8);
Intent myIntent = new Intent(context, AlarmReciever.class);
myIntent.putExtra("message",message);
myIntent.putExtra("äctivityName",activityToOpen);
final int _id = (int) System.currentTimeMillis();
PendingIntent appIntent = PendingIntent.getBroadcast(context, _id, myIntent, PendingIntent.FLAG_UPDATE_CURRENT);
//48*60*60*1000
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
48*60*60*1000, appIntent);
}catch (Exception e) {
Log.d("MyActivity", "Alarm Off");
e.printStackTrace();
}
}
알람을 시작하고 오전 8시에 통지합니다.을 입력 한 다음 48 시간 후에 반복합니다.
그러나 48 hours
다음에 알람을 시작하거나 7 hours
이후에 말하고 나서 48 hours
을 반복합니다.
로직을 도와주세요. 미리 감사드립니다. 이 8'o 시계로 시간을 설정합니다으로
시작 시간을 추가하는 방법을 묻는 질문이 있으십니까? 'Calendar # add()'메소드를 보라. –
안녕 마이크. 아니. 초기 발사 요일과 시간을 설정하는 방법을 묻습니다. 예를 들어. 응용 프로그램을 설치했지만 프로파일을 작성하지 않았습니다. 따라서 응용 프로그램은 7 일 동안 기다린 다음 알람을 시작하여 프로필을 만들도록 요청합니다. 이 알람은 사전 정의 된 시간에 대체 요일에 반복됩니다. –
그래, 그렇다. 초기 경보의 현재 시작 시간에 7 일을 추가하려고합니다. –