package com.example.db;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
public class Receiver extends BroadcastReceiver {
static String ACTION1 = "android.intent.action.ACTION_POWER_CONNECTED" ;
static String ACTION2 = "android.intent.action.ACTION_POWER_DISCONNECTED" ;
@Override
public void onReceive(Context context, Intent intent) {
}
}
|
브로드캐스트리시버 소스구요
@Override
public void onCreate()
{
intent3 = new Intent(Service. this , Receiver. class );
if (intent3.getAction().equals(ACTION1))
{
Toast.makeText(context, "Be received action aboutACTION_POWER_CONNECTED" , 1000 ).show();
}
else if (intent3.getAction().equals(ACTION2))
{
Toast.makeText(context, "Be received action aboutACTION_POWER_DISCONNECTED" , 1000 ).show();
}
super .onCreate();
}
|
서비스 소스 일부입니다.
브로드캐스트리시버 쪽에 주석처리 해놓은 부분을 service의 onCreate() 에 넣었는데
서비스 실행시키자마자 에러가 뜨네요 ㅠ 어디가 잘못된건가요?