Trouble getting location to recorded audio

by Pich » Sun, 29 Nov 2009 04:21:05 GMT

Sponsored Links

I have to following code to launch and the audio recorder on Android:

final Intent recordSoundIntent = new Intent
String fileName = Environment.getExternalStorageDirectory() +
File.separator + UUID.randomUUID() + ".3gpp";
recordSoundIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new
getString(R.string.record_sound_chooser)), INTENT_SOUND_RECORDING);

And the following code to save the location to the newly recorded

Uri uri = data.getData():

And this code to play (it works with no problem):

MediaPlayer mp = new MediaPlayer();

My problem is the following:

1. My filename (fileName) has no effect, the Uri returned from
data.getData() returns in my last test run: 
However, this file is created on my sdcard: recording34485.3gpp. If it
is not possible to set custom location upon creating sound it is the
location to this file I would like.

2. I want to mail this recording using the ACTION_SEND, but I can't
attach the audio file, I guess because soundRecording.getLocation()
points to content://media/external/audio/media/41 and not
File file = new File(soundRecording.getLocation());
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));

Can anyone help me?

Best regards



Other Threads

1. When an app needs Google account credentials...

Let's say my app needs to use the Google account of the phone user,
e.g. to interact with their contacts, mail etc or any other Google
service requiring authentication.  Now, the phone's user has logged in
to their Google account once and once only I expect, and all the built-
in apps are using that same login information, or more likely just an
authenticated token generated on first login.

As an app writer, I don't expect my users will want to give their
username and password *again* to my app, having already done it once
for the phone as a whole.

So how do apps like these go about it?  I know there are plans in the
works for an API to interact with the "Google Login Service", but
there are already many, many applications out in the wild which
already do this (including the built-in Google-written apps).

How do they do this?


2. Where do I put my .adk file?

I built a simple hello world application and I have the .adk file.  i
transfered the .adk file onto my g1 phone.  I see it in the top-level
directory, but how can I execute it now?  I think I need to copy it to
the system\app directory on the phone (where I see the rest of
the .adk files)... However, I dont know how to copy it there.  My
android file manager wont copy/paste it there.  How do I get my app to
fireup on the g1 phone?


3. gestureDetector. Where is the onUp?

4. HTTP compression lost when using 3G connection

5. Replacing Dialer, IM, and SMS Apps

6. Is Opencore (Packet Video) supporting WMV video format?

7. Overriding Contacts View