1

hello i develop app to android wear on lg urbane and i try to record Sound with this code:

MediaRecorder recorder = new MediaRecorder();
 recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
 recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
 recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
 recorder.setOutputFile(PATH_NAME);
 recorder.prepare();
 recorder.start();   

premission:

<uses-feature android:name="android.hardware.type.watch" />
<uses-permission android:name="android.permission.BODY_SENSORS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.RECORD_AUDIO"></uses-permission>
<uses-permission android:name="android.permission.WAKE_LOCK" />

LOG cat:

03-03 13:17:13.150 16423-16423/com.example.s.smart E/MediaRecorder: start failed: -2147483648
03-03 13:17:13.151 16423-16423/com.example.s.smart D/AndroidRuntime: Shutting down VM
03-03 13:17:13.151 16423-16423/com.example.s.smart E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.s.smart, PID: 16423
java.lang.RuntimeException: start failed.
at android.media.MediaRecorder.start(Native Method)
at com.example.omri.s.WatchOut$1.onFinish(WatchOut.java:116)
at android.os.CountDownTimer$1.handleMessage(CountDownTimer.java:127)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5422)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

check Question:

1. -link-

and all google search

TRY this option :

recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_WB);

try requast fucos from AudioManeger

I think that okGoogle block my mic, and try to requast the fucos, but still not work

android V of the watch 23

Community
  • 1
  • 1
Omri Lugasi
  • 337
  • 3
  • 16

0 Answers0