전화 상태가 유휴 상태 일 때 액티비티를 호출해야합니다. 그러나 그것은 말합니다 생성자 인 텐트 (MyPhoneStateListener, 클래스)는 정의되지 않았습니다. 활동을 어떻게 호출 할 수 있습니다.PhoneStateListener에서 액티비티를 호출해야합니다.
public class MyPhoneStateListener extends PhoneStateListener {
//static String org="";
public void onCallStateChanged(int state,String incomingNumber){
switch(state){
case TelephonyManager.CALL_STATE_IDLE:
Log.d("DEBUG", "IDLE");
// MissedCall ms=new MissedCall();
Intent missintent=new Intent(this,MissedCall.class);
startActivity(missintent);
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
Log.d("DEBUG", "OFFHOOK");
break;
case TelephonyManager.CALL_STATE_RINGING:
Log.d("DEBUG", "RINGING");
break;
}
}
}
감사합니다. Vineet. 하지만 "StartActivity (Intent) 메서드는 MyPhoneStateListener 유형에 대해 정의되지 않았습니다."라는 메시지가 표시됩니다. – Manikandan
MyPhoneStateListener 클래스를 서비스에 넣습니다. 다음을 확인하십시오. http : //lovingandroid.blogspot.com/2011/07/intercept-call-activity.html –
서비스에 MyPhoneStateListener 클래스를 추가했지만 동일한 오류가 발생했습니다. . – Manikandan