2012-01-14 1 views
0

私はアンドロイドのnewbです。フォンコールがデバイスで受信されたときに起動するアプリケーションで作業していて、IntenServiceを呼び出してメディアを録音します。recorder.hereは私のメディアですログcat出力。何がメディアレコーダーのエラー-1です

01-14 13:58:07.319: D/DEBUG(18180): <!>com.agicent.callrecorder.CallListener 26<!> 
OFFHOOK 
01-14 13:58:07.319: E/AudioRecordTest(18180): 
<!>com.agicent.callrecorder.PhoneCallRecorderActivity 181<!> Recording Started 
01-14 13:58:07.469: E/AudioRecordTest(18180): 
<!>com.agicent.callrecorder.PhoneCallRecorderActivity 181<!> Recording Started 
01-14 13:58:07.499: E/MediaRecorder(18180): start failed: -1 
01-14 13:58:07.509: W/dalvikvm(18180): threadid=9: thread exiting with uncaught 
exception (group=0x40018560) 
01-14 13:58:07.509: E/AndroidRuntime(18180): FATAL EXCEPTION: 
IntentService[PhoneCallRecorderActivity] 
01-14 13:58:07.509: E/AndroidRuntime(18180): java.lang.RuntimeException: start failed. 
01-14 13:58:07.509: E/AndroidRuntime(18180): at 
android.media.MediaRecorder.start(Native Method) 
01-14 13:58:07.509: E/AndroidRuntime(18180): atcom.agicent.callrecorder.PhoneCallRecorderActivity.startRecording(PhoneCallRecorderActivity.java:77) 
01-14 13:58:07.509: E/AndroidRuntime(18180): at com.agicent.callrecorder.PhoneCallRecorderActivity.onHandleIntent(PhoneCallRecorderActivity.java:182) 
01-14 13:58:07.509: E/AndroidRuntime(18180): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:59) 
01-14 13:58:07.509: E/AndroidRuntime(18180): at android.os.Handler.dispatchMessage(Handler.java:99) 
01-14 13:58:07.509: E/AndroidRuntime(18180): at android.os.Looper.loop(Looper.java:123) 
01-14 13:58:07.509: E/AndroidRuntime(18180): at android.os.HandlerThread.run(HandlerThread.java:60) 
01-14 13:58:20.539: E/IncomingCall Recieved(18256):  <!>com.agicent.callrecorder.IncomingCallReciever 33<!> Broadcast Recieved 
01-14 13:58:20.569: D/DEBUG(18256): <!>com.agicent.callrecorder.CallListener 22<!> IDLE 

そして、ここで私に私のコードブロック

public class PhoneCallRecorderActivity extends IntentService { 

private static final String LOG_TAG = "AudioRecordTest"; 
private static String mFileName = null; 
//private RecordButton mRecordButton = null; 
private MediaRecorder mRecorder = null; 
//private PlayButton mPlayButton = null; 
private MediaPlayer mPlayer = null; 

private void startPlaying() { 
    mPlayer = new MediaPlayer(); 
    try { 
     mPlayer.setDataSource(mFileName); 
     mPlayer.prepare(); 
     mPlayer.start(); 
    } catch (IOException e) { 
     Log.e(LOG_TAG, "prepare() failed"); 
    } 
} 

private void stopPlaying() { 
    mPlayer.release(); 
    mPlayer = null; 
} 

private void startRecording() { 
    mRecorder = new MediaRecorder(); 
    mRecorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL); 
    mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); 
    mRecorder.setOutputFile(mFileName); 
    mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); 


    try { 
     mRecorder.prepare(); 
    } catch (IOException e) { 
     Log.e(LOG_TAG, "prepare() failed"); 
    } 

    mRecorder.start(); 
} 

private void stopRecording() { 
    mRecorder.stop(); 
    mRecorder.release(); 
    mRecorder = null; 
} 

public PhoneCallRecorderActivity() { 
    super("PhoneCallRecorderActivity"); 
    mFileName = Environment.getExternalStorageDirectory().getAbsolutePath(); 
    mFileName += "/audiorecordtest.3gp"; 
} 
@Override 
public IBinder onBind(Intent intent) { 
// TODO Auto-generated method stub 
return null; 
} 

@Override 
protected void onHandleIntent(Intent intent) { 
// TODO Auto-generated method stub 
Log.e(LOG_TAG, "Recording Started"); 
startRecording(); 
} 
public void onDestroy() { 

stopRecording(); 
Log.e(LOG_TAG, "Recording finidhed"); 

} 
} 

私が間違っているのどこに私を提案してください。 ありがとうございました。

+0

もマニフェスト権限を投稿してください。 –

+0

あなたの時間の上のハイクマのおかげで私のマニフェストのアクセス許可と私のテストデバイスLG - オプティマスワンです。 –

+0

http://stackoverflow.com/questions/5630922/how-to-record-a-call-in-android –

答えて

0

実際の通話自体(ローカル音声とリモート音声)を録音しようとする場合は、Androidでは不可能です。通話音声情報はAndroid自体の外で処理されるためです。

関連する問題