Pass parameters to Voice Recorder - android

I need to record Audio, And I would be pleased to use Built in Voice Recorder, but it would be nice to pass it parameters : Specific Path, Specific Quatlity, etc.
Is it posible?
I like this solution because code is very short:
Intent intent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(intent, AUDIO_RECORDING);
Here I have an example to copy file to specific location:
How can I specify the output file's folder when calling RECORD_SOUND_ACTION?

I guess it is not posible. If you need to customize it, you will need to develop your own activity. You can work with google Sample !
http://developer.android.com/guide/topics/media/audio-capture.html

Related

Error in creating a folder using Storage Access Framework

I am using Storage Access Framework and want to create a folder (location choosed by user through file picker) but instead it is creating a file without any extension.
I am using ACTION_CREATE_DOCUMENT for this, you can check the intent call below:
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.setType("application/vnd.google-apps.folder");
intent.putExtra(Intent.EXTRA_TITLE, "CCM-Tele ICU");
startActivityForResult(intent, MAKE_DIRECTORY_REQUEST_ID);
But instead of folder it is creating this:
I have tried creating files and it works fine but unfortunately, folder is not being created.
I solved the problem of directory creation so answering my own question maybe it will help someone in future.
The Mime type that I was using is incorrect. So change it to: DocumentsContract.Document.MIME_TYPE_DIR
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.setType(DocumentsContract.Document.MIME_TYPE_DIR);
intent.putExtra(Intent.EXTRA_TITLE, "CCM-Tele ICU");
startActivityForResult(intent, MAKE_DIRECTORY_REQUEST_ID);
But it's useless as I can't use it to store things afterwards using SAF. So it's better to use ACTION_OPEN_DOCUMENT_TREE instead

Launch native camera app with option to capture either video or image

I've written an app before where I open the native camera app to capture an image like this:
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
Or, like this for capturing video:
Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
But is there a way to open the native camera app with the option to capture either video or an image? I'd like to open to the image given below, where the user can swipe to access the side-menu and change their input type.
I've tried searching, but no results have come up yet. I'm not sure if there is a way to do this without writing a custom camera implementation, which I'd like to avoid for now.
If this is possible, how can I do it? And how could I go about recognizing what media type the user has chosen once the capture is complete (in onActivityResult, probably)?
Thank you in advance!
Currently As specified by you there are 2 intents for capturing image and video i.e. MediaStore.ACTION_IMAGE_CAPTURE & MediaStore.ACTION_VIDEO_CAPTURElink.
For intially I was also thinking startActivityForResult (Intent intent, int requestCode, Bundle options), Here options param was used to give the extras for the external applications but we can only specify some animations not the values as specified link1 & link2.
Solution
I would rather suggest you to go for the custom app with options as you like rather than the restrictions given by the existing camera app.

android get path of recorded video/audio

I let the user record a video/audio by doing following:
Intent videoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(videoIntent, VIDEO_REQUEST);
//pretty the same thing for audio
I'm not sure what to do in the onActivityResult() method to get the Uri of the recorded file and then convert it to an absolute path like /mnt/sdcard/DCIM/Camera/1231.avi
Any help is appreciated.
Try my program wherein you will get how to get the Path.The Link is as follows:-Imp Link.

How to limit the picture size took from IMAGE_CAPTURE intent

I use
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(getSomePath()+"temp.jpg")));
//intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
startActivityForResult(intent, 0);
to get a picture and the saved picture returns as full-size.
But I want to get a limited picture, like 800*640, because on different devices I get different sizes, and I don't need that big picture.
I notice that there is a EXTRA_SIZE_LIMIT in MediaStore , but I can't find how to use it, what parameter should be set?
Answering my own question.
Finally I found that's because different manufacturers customize their Rom, including the Camera app, so the best way is not to call the default camera app, instead we can write a activity use hardware.camera to take picture. There are a lot of examples for this around the Internet too.
Unfortunately EXTRA_SIZE_LIMIT used for video limit in bytes.

Extend android app

I'd like to create an app that is the same as the default camera app only with one small modification (i.e. video disabled or extra functionality added). How do I do it?
Do I just get the source code of the camera app and modify it or is there a way to extend core components of the Android system?
bizso99,
You can call an Intent from your Activity that is simply the camera sans video functionality like so:
public void imageFromCamera() {
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, TAKE_PICTURE);
}
This will return a smaller thumbnail version of the image. If you want the full size you need to use the Mediastore.EXTRA_OUTPUT like so:
public void imageFromCamera() {
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
mImageFile = new File(pathToStoreImage); //file where image will be stored
mSelectedImagePath = mImageFile.getAbsolutePath(); //path to file where image will be stored
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(mImageFile));
startActivityForResult(intent, TAKE_PICTURE);
}
Then you can receive the picture in onActivityResult()
Android is open source, so you can download the source for every stock-app in android (not for the google apps like Maps). You can in fact download the most recent original camera app from the android git repo. The building of the apk is only possible if you download the whole android-source. For a overview how to build the android-source, see this howto. You could modify the source for your needs.
I'm quite sure that it is impossible to extend the camera-app without copying the source because there is no plugin-api (or similiar) for the camera-api.

Categories

Resources