BroadcastReceiver 의 onReceive() 가 호출이 안됩니다 ㅠㅠ
background service 를 돌릴 목적으로 ( 주기적으로 http parsing 하여 notify ) 구현중인데.. ㅠㅠ
2개의 클래스 입니다.
noti_list.class - extends Activity
noti_alarmManager.class - extends BroadcastReceiver
====================================================
noti_list.class
// 알람 매니저를 위한 선언
AlarmManager am;
Intent intent_am;
PendingIntent sender;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.notice_main);
am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
intent_am = new Intent(notice_list.this, notice_alarmManager.class);
sender = PendingIntent.getBroadcast(notice_list.this, 0, intent_am, 0);
// 알람을 실행합니다. - 주기적으로 브로드캐스팅 하기를 원함
am.setRepeating(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime(), 5000, sender);
...
...
====================================================
====================================================
public class notice_alarmManager extends BroadcastReceiver {
Context mContext;
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
mContext = context;
// 디버깅을 위한 로그와 간단한 토스트
Log.i("R_start","Recieve on");
Toast.makeText(context, "on Receive", Toast.LENGTH_SHORT).show();
...
...
} // end of onReceive(...)
====================================================
noti_list.class 에서 setRepeating(...)으로 브로드캐스트를 호출하면,
당연히 noti_alarmManager.class 의 onReceive(...)가 호출되어서 일을 해야하는데,
onReceive(...) 자체가 호출이 안되는거 같습니다.
로그와 토스트를 띄웠는데 도무지 호출이 안됩니다. LogCat에도 안뜨고.. ㅠㅠ
====================================================
매니페스트에서는 다음과 같습니다.
<receiver android:name="notice_alarmManager"></receiver>
====================================================
고수님들 도움을 절실히 부탁드립니다. ㅠㅠ




리시버 안에 어떤 액션에서 리시버가 호출되는지 액션 정의하는 부분이 빠져 있네요.