0

I have been using the following code on all android devices for a while with no problem. I have since updated my Amazon code to match and their test have produced FAIL with the code.

After testing on emulator I am getting

01-08 22:04:33.322: E/AudioRecordTest(2857): prepare() failed 01-08 22:04:33.322: E/MediaRecorder(2857): start called in an invalid state: 4

code is

 mRecorder = new MediaRecorder();
        mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
        mRecorder.setOutputFile(mFilePath + listOfAvailableFileNames.get(0));
        mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

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

        if (mRecorder != null) {
            mRecorder.start();
        }

Odd behavour

RuAware
  • 979
  • 1
  • 9
  • 26
  • are you testing on an emulator, or a physical device? – Offbeatmammal Jan 10 '14 at 16:04
  • I tested on an emulator but Amazon have said the have the same problem with my app on devices but can't send me logs – RuAware Jan 10 '14 at 17:58
  • Can you share the apk? I have an HDX and might be able to get something... – Offbeatmammal Jan 10 '14 at 18:00
  • have you got access to google play on it? App is in the app store called edudroid, This has beens amazon response https://forums.developer.amazon.com/forums/thread.jspa?threadID=2445&tstart=0 – RuAware Jan 10 '14 at 18:04
  • I will have a look later today... – Offbeatmammal Jan 10 '14 at 18:06
  • looks like it's published on Amazon - were you able to fix it? they both say they are version 1.1.1 – Offbeatmammal Jan 13 '14 at 23:36
  • no unfortunately due to not having a successful test on a device I omitted that module from the app for device with Amazon as manufacture. It's a shame and this problem still exists. The app is still full of features, just need to get this to work :) – RuAware Jan 14 '14 at 19:01
  • looks like the Play version dies on my Kindle with a Google IAP check :( http://pastebin.com/W02XVt5x ... happy to run a Kindle-ized version with the MediaRecorder in if you can link me to the apk – Offbeatmammal Jan 15 '14 at 04:18

1 Answers1

0

try made mFilePath equal that

mFilePath = getExternalCacheDir().getAbsolutePath();
mFilePath += "/audiorecordtest.3gp";