안드로이드 개발 질문/답변
(글 수 45,052)
public class SMSHandler extends BroadcastReceiver
{
private NotificationManager nm=null;
Context mcontext;
.....//여기에 문자를 받았을때 처리일 할 일들을 써주었고요.
//그중 특정 이벤트에서 노티를 띄워줄라고 하고 있는데요 .
//디버깅 해보니깐 오류가 뜨네요 ㅠㅠ
//블로그에 있는 것들은 모두 extends Acivity 에서 작업하는 거라 다른건지 ㅜㅜ
//답변 부탁드릴께요~^^
nm=(NotificationManager) mcontext.getSystemService(Context.NOTIFICATION_SERVICE); //요기서 오류가 나네요 ㅠㅜㅜ
Notification noti = new Notification(R.drawable.smp,cardn+" 한도금액을 초과하셨습니다.",System.currentTimeMillis());
감사합니다~
온리시버 밖에서 작업을 하신거같네요.....?
노티를 띄우는 작업을 메소드로 하나 따로 해놓고
mcontext값을 온리시버에서 받는 파라미터인 context 값으로 초기화 시켜주면 될겁니다.