Skip to content

Commit

Permalink
fix: Handle missing MediaProjection APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
timschneeb committed May 23, 2023
1 parent 25420c3 commit 172f088
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,13 @@ class MainActivity : BaseActivity() {
RootlessAudioProcessorService.start(this, app.mediaProjectionStartIntent)
return
}
capturePermissionLauncher.launch(mediaProjectionManager.createScreenCaptureIntent())
try {
capturePermissionLauncher.launch(mediaProjectionManager.createScreenCaptureIntent())
}
catch (ex: ActivityNotFoundException) {
toast(getString(R.string.error_projection_api_missing))
Timber.e(ex)
}
}

private var processorMessageReceiver: BroadcastReceiver = object : BroadcastReceiver() {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<string name="no_activity_found">No Activity found to handle action</string>
<string name="permission_allowed">Allowed</string>
<string name="permission_not_allowed">Not allowed</string>
<string name="error_projection_api_missing">Your device manufacturer has disabled the internal audio recording APIs. This application cannot work without them.</string>

<!-- Main screen -->
<string name="power_button_alt">Toggle audio processing</string>
Expand Down

0 comments on commit 172f088

Please sign in to comment.