2013-06-04 2 views
-1

나는 전화가 왔는지, 즉 전화가 왔는지 확인하는 등의 방법으로 안드로이드 전화 번호를 알려주고 있습니다. 당신이 다시 내 응용 프로그램에 통화를 종료하고 통화 시간이 될 수 있다면 그게 내가 전화가 대답했다 있는지 알고 싶을 때 그리고 때android에서 회답 확인 전화 받기

Intent callIntent = new Intent (Intent.ACTION_CALL, Uri.parse (number)); 
startActivity (callIntent); 

: 전화를 걸려면 다음 코드를 사용합니다.

+0

[nan12] (http://stackoverflow.com/users/ 1389212/nan12) simillar 질문 게시 반복 중지 – Selvin

답변

1

당신이 할 수있는 네, 당신은 예를

위한 의도 와
<receiver android:name=".broadcast.DontMissReceiver" > 
      <intent-filter> 
       <action android:name="android.intent.action.PHONE_STATE" /> 
      </intent-filter> 
    </receiver> 

을 브로드 캐스트 리시버를 만들 필요가 다음 수신기에

@Override 
    public void onReceive(final Context context, Intent intent) { 
     String action = intent.getAction(); 
     if (action.equalsIgnoreCase(PHONE_ACTION)) { 
      this.receivePhoneCall(context, intent); 
      } 
    } 

    private void receivePhoneCall(Context context, Intent intent) { 
     String curState = intent.getExtras().getString("state"); 

     if (curState.equalsIgnoreCase("RINGING")) { 
     } else 

     if (curState.equalsIgnoreCase("IDLE") && state.length() > 0) { 
      if (!state.equalsIgnoreCase("OFFHOOK")) { 

      } 
     } 

    }