2012-10-17 4 views

답변

10

당신이 말하는 것은 정확히 Android에서 가능하지 않습니다. Android는 통화 중 오디오 스트림에 액세스 할 수 없습니다.

내가 어떻게하는지에 대해 조금 알려 줄 수는 있지만. 걸려 오는 전화를 차단하는

첫째, 당신은

이와
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" /> 
    <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission> 
    <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/> 
    <application 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" > 
     <receiver android:name="MyReceiver"> 

      <intent-filter> 

       <action android:name="android.intent.action.NEW_OUTGOING_CALL" /> 



      </intent-filter> 
     </receiver> 
    </application> 

, 당신이 가로 챌 수 있으며, 통화가 또한 매니페스트를 변경

public void onReceive(final Context context, Intent intent) 
{ 
    TelephonyManager telephonyManager = null; 
    PhoneStateListener listener = new PhoneStateListener() 
    { 
     public void onCallStateChanged(int state, String incomingNumber) 
     { 
      switch (state) 
      { 
      case TelephonyManager.CALL_STATE_IDLE: 
       Toast.makeText(context, "Call Ended..", Toast.LENGTH_LONG).show(); 
       Log.i("stop", "Call Ended...."); 
       break; 
      case TelephonyManager.CALL_STATE_OFFHOOK: 
       Toast.makeText(context, "Call Picked..", Toast.LENGTH_LONG) .show(); 
       Log.i("received", "Call Picked...."); 
       break; 
      case TelephonyManager.CALL_STATE_RINGING: 
       Toast.makeText(context, "Call Ringing.." + incomingNumber,5000).show(); 
       break; 
      } 
     } 
    }; 
    // Register the listener with the telephony manager 
    telephonyManager.listen(listener, PhoneStateListener.LISTEN_CALL_STATE); 

를 수신 될 때마다 호출되는 방송 수신기를 등록해야 걸려 오는 전화를 걸고 전화를 받으면 이제는 mp3 파일을 재생 해 볼 수 있습니다.

case TelephonyManager.CALL_STATE_OFFHOOK: 
       // Play mp3 file here 
       break; 

희망이 도움이됩니다. 이것을 시도하고 경험을 말해봐.

+0

확인해야합니다 내가 시도하고 알려줍니다 원하는 녹화를 재생하는 다른 장치에서 bluetooh를 사용할 수 있습니다. –

+1

행운이 있나요? – CasualT

+0

@CasualT 원하는 것을.? –

3

. 확성기로 연주하고 싶다면 실제로 원하는 것은 아닙니다. 그래서 "아니오", 당신은 그것을 할 수 없습니다.

0

안드로이드에서는 라이브 전화를 사용하거나 오디오 소스를 다른 기본 마이크로 전환 할 수있는 옵션이 없습니다! 여기 세부 사항은, why you can't play recordings during a live call

그러나 약간의 트릭이 있음 있습니다

  1. 당신은 통화 중 모바일 스피커에서 원하는 녹음을 재생할 수 있습니다! 마이크가 거기에서 골라 낼거야?
  2. 또는 당신은 마이크 와이어
  3. 에 핸즈프리 스피커 와이어를 상호 연결 또는