2012-05-25 53 views

回答

1

僅在VOIP中,Android應用程序無法訪問通話中的音頻流。你可以在免提模式下僞裝一下。

+0

我該怎麼做在免提模式?使用Tonegenerator? –

+0

我用下面的代碼ToneGenerator mToneGenerator嘗試了它; \t \t \t mToneGenerator =新ToneGenerator( \t \t \t \t \t AudioManager.STREAM_VOICE_CALL,100); \t \t \t \t \t \t \t \t \t如果(mToneGenerator!= NULL){ \t \t \t \t音調++; \t \t \t \t mToneGenerator.startTone(tone,500); \t \t \t \t如果(音調== 9) \t \t \t \t { \t \t \t \t \t色調= 0; \t \t \t \t} \t \t \t}而不是在另一方面越來越音 –

-2

嘗試此方法()。它從用戶獲取數量和延遲。

private void call(int profileid) {//call procedure logic 
     ProfileDo profile = adapter.getProfile(profileid); 
     if (profile.getStepCount() == 0) { 
      Toast.makeText(getApplicationContext(), "Please edit the profile and add atleast one value to make a call", 10000).show(); 
      return;} 
      String call = "tel:"; 
     for (StepDO step : profile.getSteps()) { 
      String value = URLEncoder.encode(step.getValue()); 
      int delay = step.getDelay(); 
      String pausesStr = ""; 
      for (int i = 0; i < delay/2; i++) { 
       pausesStr += PhoneNumberUtils.PAUSE; 
      } 
      call += value + pausesStr; 
     } 
     startActivity(new Intent("android.intent.action.CALL", Uri.parse(call)));  
    }