안드로이드 개발 질문/답변
(글 수 45,052)
서비스에서 이벤트 발생할때 다음과 같이 브로드캐스트를 시도했습니다.
Intent myIntent = new Intent("com.android.action.MESSAGE");
sendBroadcast(myIntent);
이 메세지를 액티비티에서 받고 싶은데요.
public class TestActivity extends Activity {
public BroadcastReceiver TestReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Log.v("RECEIVE MSG!!!!", "");
}
};
이렇게 해봤는데 메세지가 전혀 들어오지 않네요. 메니페스트 파일은 다음과 같이 추가했습니다.
<activity android:name="TestActivity">
<receiver android:name=".TestActivity"> <-- 이렇게 해도 되는건지요?
<intent-filter>
<action android:name="com.android.action.MSG" />
</intent-filter>
</receiver>
</activity>
고수님들의 따끔한 조언 부탁드립니다.




올리신 글에서 name이 같지 않네요. 오타인가요?
그리고 registerReceiver로 리시버 등록 하신건가요?