summaryrefslogtreecommitdiffstats
path: root/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
diff options
context:
space:
mode:
authorDanesh M <daneshm90@gmail.com>2014-11-25 12:38:19 -0800
committerBrint E. Kriebel <bekit@cyngn.com>2014-11-25 23:00:46 +0000
commitacde7481a8d87c4d94ee3cfc937ef7f1ad24253e (patch)
tree2c41b4d193b6509500734bbe18a99c113f6268a4 /FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
parent00c2c96bdecc2ed354cbada93df7f8ce5182af1b (diff)
downloadandroid_hardware_qcom_fm-acde7481a8d87c4d94ee3cfc937ef7f1ad24253e.tar.gz
android_hardware_qcom_fm-acde7481a8d87c4d94ee3cfc937ef7f1ad24253e.tar.bz2
android_hardware_qcom_fm-acde7481a8d87c4d94ee3cfc937ef7f1ad24253e.zip
FMRecorder : Save to a private temporary file while recording
While recording save to a temporary private file and once finished, move to external storage Change-Id: If82a84beeffe2ea8e5ba4bf7e93e4f3d6203e10f (cherry picked from commit 3d6236300fdc02fefc2032c482c8a0fcf71649b1)
Diffstat (limited to 'FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java')
-rw-r--r--FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java b/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
index bf99dd8..febbbde 100644
--- a/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
+++ b/FMRecord/src/com/codeaurora/fmrecording/FMRecordingService.java
@@ -259,10 +259,11 @@ public class FMRecordingService extends Service {
}
mSampleFile = null;
- File sampleDir = Environment.getExternalStorageDirectory();
+ File sampleDir = getExternalCacheDir();
try {
- mSampleFile = File.createTempFile("FMRecording", ".3gpp", sampleDir);
+ mSampleFile = new File(sampleDir, "FMRecording.3gpp");
+ mSampleFile.createNewFile();
} catch (IOException e) {
Log.e(TAG, "Not able to access SD Card");
Toast.makeText(this, "Not able to access SD Card", Toast.LENGTH_SHORT).show();
@@ -370,6 +371,18 @@ public class FMRecordingService extends Service {
Log.d(TAG, "storage state is " + state);
if (Environment.MEDIA_MOUNTED.equals(state)) {
+ File finalFile;
+ try {
+ finalFile = File.createTempFile("FMRecording", ".3gpp",
+ Environment.getExternalStorageDirectory());
+ mSampleFile.renameTo(finalFile);
+ mSampleFile = finalFile;
+ } catch (IOException e) {
+ Log.e(TAG, "Not able to access SD Card");
+ Toast.makeText(this, "Not able to access SD Card", Toast.LENGTH_SHORT).show();
+ e.printStackTrace();
+ }
+
try {
this.addToMediaDB(mSampleFile);
Toast.makeText(this,getString(R.string.save_record_file,