마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

알람매니저 등록할 때 사용한 intent의 값을 가져오고 싶어요.

0 추천
// 알람 저장
File file = new File(_fullPath);
Intent intent = new Intent(this, AlarmReceiver.class);
intent.putExtra("path", file.toString);
intent.putExtra("day_of_week", "0110001"); // 일월화수목금토 순
PendingIntent pIntent = PendingIntent.getBroadcast(this, file.hashCode(), intent, PendingIntent.FLAG_UPDATE_CURRENT);

// 설정된 시간부터 시작해서 24시간마다 반복하게
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, _timePicker.getCurrentHour());
cal.set(Calendar.MINUTE, _timePicker.getCurrentMinute());

long interval = 24 * 60 * 60 * 1000;
_audioManager.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), interval, pIntent);

 

일단 이런 식으로 알람매니저를 등록했어요.

동작은 잘 되는데, intent에 넣은 "day_of_week" 값을 receiver가 아닌 알람을 등록한 activity에서 가져와야 합니다.

receiver에서는 넘어 온 값을 이용하면 되는데 말이죠..

 

저 day_of_week 값을 이용해서 일곱 개 버튼의 사용여부를 결정해야 하는데, 값을 어떻게 받아와야 하나요?

쎄미 (162,410 포인트) 님이 2013년 11월 27일 질문

1개의 답변

0 추천
day_of_week 변수를 전역변수로 지정하면 됩니다. 알람 예제는 여기에서 다운받으세요.

 

http://blog.naver.com/goodsogi/40201603747
방귀과장 (18,940 포인트) 님이 2013년 11월 27일 답변
알람이 하나가 아니라서 전역으로 등록하기에는 무리가 있습니다...
...