Post error notification if start() fails.
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2c1a155..d08bd6e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -14,5 +14,6 @@
<string name="error_unable_to_create_directory">Unable to create output directory.</string>
<string name="error_external_storage_unavailable">No external storage available.</string>
+ <string name="error_unable_to_start">Unable to start recording.</string>
</resources>
diff --git a/src/org/chameleonos/screenrecorder/ScreenRecorderService.java b/src/org/chameleonos/screenrecorder/ScreenRecorderService.java
index e575126..a46658c 100644
--- a/src/org/chameleonos/screenrecorder/ScreenRecorderService.java
+++ b/src/org/chameleonos/screenrecorder/ScreenRecorderService.java
@@ -120,7 +120,13 @@
sCurrentFileName = getVideoFileName();
final String fileName = RECORDER_PATH + File.separator + sCurrentFileName;
Log.d(TAG, "Start recording screen to " + fileName);
- sScreenRecorder.start(fileName);
+ try {
+ if (!sScreenRecorder.start(fileName)) {
+ postRecordingErrorNotification(getString(R.string.error_unable_to_start));
+ }
+ } catch (IllegalStateException e) {
+ postRecordingErrorNotification(getString(R.string.error_unable_to_start));
+ }
}
/* Screen recorder callbacks */