I looked over the code and didn't see anything obvious. You won't see anything in the log unless an error occurs - we try to minimize logging in production code.
Run adb bugreport and take a look at the kernel log. You should see something like this: <6>[ 820.265000] adsp: opening module AUDPREPROCTASK <6>[ 820.265488] audmgr_rpc_thread() start <6>[ 820.266281] adsp: module AUDPREPROCTASK has been registered <6>[ 820.266586] adsp: opening module AUDRECTASK <6>[ 820.267838] adsp: module AUDRECTASK has been registered <6>[ 820.268326] snd_set_device 256 1 0 <6>[ 820.280289] audmgr: rpc_reply status 0 <6>[ 820.291489] audmgr: rpc READY handle=0x00000000 <6>[ 820.355332] audmgr: rpc CODEC_CONFIG volume=0x00002ff4 <6>[ 820.355759] msm_adsp_enable() 'AUDPREPROCTASK' <6>[ 820.357468] adsp: rpc event=0, proc_id=2, module=14, image=0 <6>[ 820.357926] adsp: module AUDPREPROCTASK: READY <6>[ 820.358688] msm_adsp_enable() 'AUDRECTASK' <6>[ 820.359909] adsp: rpc event=0, proc_id=2, module=13, image=0 <6>[ 820.360825] adsp: module AUDRECTASK: READY <6>[ 820.362259] audpre: CFG ENABLED <6>[ 820.363663] audrec: PARAM CFG DONE <6>[ 822.417343] audrec: CFG SLEEP <6>[ 822.417801] msm_adsp_disable() 'AUDRECTASK' <6>[ 822.420151] msm_adsp_disable() 'AUDPREPROCTASK' <6>[ 822.423081] adsp: closing module AUDRECTASK <6>[ 822.423508] adsp: closing module AUDPREPROCTASK <6>[ 822.423843] adsp: disable interrupt <6>[ 822.424667] snd_set_device 256 1 1 <6>[ 822.428391] audmgr: rpc_reply status 0 <3>[ 822.458450] audmgr: DISABLED If so, then we know that the audio input driver is being opened correctly. On Feb 11, 7:02 am, michael <kuh...@gmail.com> wrote: > Hi, > > I've written a little program (see below) to record audio using > MediaRecorder. While everything works fine in the emulator (SDK1r2), > the program does not work on the real phone (HTC G1). On the phone, > after pressing the start button, the audio file is created, but no > content is written to it (i.e. the file size remains 0). Also, no > exception is shown in logcat, and no AudioStreamInGeneric events are > generated (such events are generated when running the program on the > emulator). > > Is there maybe a setting on the phone that I have to turn on (or off)? > Or am I missing something else? > > I've set the permission to record audio in the android-manifest.xml > file using > <uses-permission android:name="android.permission.RECORD_AUDIO"></uses- > permission> > > Thanks for any help! > > Michael > ------------------------------ > My program code: > > package ch.ethz.dcg.mictest; > > import android.app.Activity; > import android.media.MediaRecorder; > import android.os.Bundle; > import android.util.Log; > import android.view.View; > import android.widget.Button; > > public class MicTest extends Activity { > > private final static String TAG = MicTest.class.getSimpleName(); > > private MediaRecorder recorder; > private Button button; > > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > > recorder = new MediaRecorder(); > > button = (Button)findViewById(R.id.button); > button.setText("start"); > button.setOnClickListener(new View.OnClickListener() { > @Override > public void onClick(View v) { > buttonClicked(); > } > }); > } > > private void buttonClicked() { > if (button.getText().equals("start")) { > try { > recorder = new MediaRecorder(); > String path = "/sdcard/test.3gpp"; > > > recorder.setAudioSource(MediaRecorder.AudioSource.MIC); > > recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); > > recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); > recorder.setOutputFile(path); > > recorder.prepare(); > recorder.start(); > button.setText("stop"); > } catch (Exception e) { > Log.w(TAG, e); > } > } else { > try { > recorder.stop(); > recorder.release(); // Now the object cannot > be reused > button.setEnabled(false); > } catch (Exception e) { > Log.w(TAG, e); > } > } > } > > } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---