Welcome

Development Research on Android Application

Development Research on Android Application

Introduction to MediaRecorder ClassProgramsforrecordingaudiosappliesMediaRecorder class several times, so we will introduce itfirstly. MediaRecorder is applied for audio/vedio sampling.It can execute recording for any length and lead users tostopWorkflow Diagram of MediaRecorder ClassMediaRecorder is also accomplished via OpenCORE inthe bottom, but it needs the Jave interface provided byAndroid when developing applications.B. Android Program DesignWe firstly try to realize audio recording, which can bedivided into 7 steps:Step1: Create an instance android.media.MediaRecorderwith command “new”.Step2:Createaninstanceandroid.content.ContentValues and set some standardattributes, such as TITLE, TIMESTAMP, and mostimportantly MIME_TYPE.Step3: Create the path for saving files: create an accessin the content database by android.content.ContentResolver,and identify the path for getting the file automatically.Step4: Set the audio resource with methodMediaRecorder.setAudioSource(), which may applyMediaRecorder.AudioSource.MIC.Step5: Set the file output format with methodMediaRecorder.setOutputFormat().Set the audio encoding with methodMediaRecorder.setAudioEncoder().Step7: Execute prepare() and start() for the recordedaudio, while stop() and release() are revoked in the end.Android 1.5 version starts to support the vedio recordingfunction. Videos in the format of MPEG4, H.263 andH.264 can be recorded with methods inMediaRecorder class. MediaRecorder.VideoEncoder,MediaRecorder.VideoSource classes are added to theMediaRecorder class in the related developing document,which provides the recording preview windowsetPreviewDisplay(Surface sv), but it needs prepare() beforeexecuting. setVideoFrameRate(int rate) can set frame rate,setVideoSize(int width,int height) can set the video size,and setVideoSource(int video_source) can set the videosourceAndroid Program Development and AnalysisHere we will show the key codes in the program:private Button StartButton;private Button StopButton;/*Set two buttons: “start” and “stop”*/if(Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED))/*Check if there exists SD card, if no, the screen shows”No SD Card”*/mRecAudioFile=File.createTempFile(strTempFile,”.amr”,mRecAudioPath);/*Create the audio file*/mMediaRecorder=newMediaRecorder();/*Instantiate the MediaRecorder*/mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);/*Set the microphone*/mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);/*Set the output file format*/mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);/*Set the audio file encoder*/mMediaRecorder.setOutputFile(mRecAudioFile.getAbsolutePath());/*Set the output file path*/Complete programs for audio&video recording are asfollows, which is similar with the above programs:path=”/sdcard/v.3gp”;recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);recorder.setAudioSource(MediaRecorder.AudioSource.MIC);recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);recorder.setVideoSize(176,144);recorder.setVideoFrameRate(15);recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);recorder.setOutputFile.CodeShoppy

Development Research on Android Application

When applying the Android application framework,Android will support the components via some C/C++libraries to make them service us better.Bionic system C library:itistheClanguage standardlibrary, and also the bottom library of the system,which is invoked by Linux system.Media Framework: based on the PacketVideo,OpenCORE to support the playerback and recording ofaudio and video in multiple formats, such as MPEG4,MP3, AAC, AMR, JPG, PNG.SGL: 2Dgraphics engine library.SSL: located between TCP/IP protocol and otherapplication protocols to support data communication.OpenGL ES1.0: support for 3D effect.SQLite: relational database.Webkit: Web browser engine.FreeType: bitmapand vector.All the Java programs are running on the Dalvik virtualmachine. Similar with PC, each Android application program has its own process, and Dalvik virtual machineonly executes the executable file as “.dex”. So,after compiling Java programs, they also need to betransferred to “.dex” by dx tool in SDK to run on the virtual machine [4].Google released Android ADK officially at the end of2007, and Dalvik virtual machine enters people’s visionfirstly. Its efficient use of memory and high performance inlow speed CPU really sits up and takes notice. Androidsystem can simply complete the processes isolation andthreads management. Each Android application correspondsto an independent Dalvik virtual machine instance onthe bottom and its code are executed in the virtual machineinterpretation. To sum up, Dalvik virtual machine has thefollowing characteristics:Proprietaryfile format “.dex”: dex is theproprietaryfile format. It abandons the “.class” file and appliesnew format to improve the file parse and search speed,and also support the new operating codes.optimizations on dex file: the structure of dex fileis compact, and it is optimized to further improve therunning performance, including adjusting the bytesequences of all the fields, verifying all the classes in”.dex” file, and optimizing the operating codes of someparticular classes and methods.Register: compared with the virtual machine based onstacks, virtual machine based on registers is weaker inhardware and universality, but it shows higher codeexecute efficiency.An application, a virtual machine instance, aprocess:Each Android application is running in a Dalvik virtualmachine instance, and each virtual machine instance isa independent process space. The thread mechanism,memory allocation and management, implementationof Mutex are dependent on the underlying operatingsystems. Each Android application thread correspondsto a Linux thread, thus the virtual machine can bemore dependent on the thread scheduling andmanagement mechanism of virtual machine. Differentapplications run in different threads space, andapplications from different resources run by differentLinux users to maximize protect the security of application and independent operation.Based on the architecture introduction of Android platform, this paper shows the Android program design and development for audio/video file procurement. It mainlyapplies OpenCORE and Media Recorder class. After the test,our program can successfully realize the procurement andplaying of the audio/video files with fast execution speed and good user experience.

https://codeshoppy.com/android-app-ideas-for-students-college-project.html

Leave a Reply

Your email address will not be published. Required fields are marked *