From 172f08846dee707c612aa8980f7e5a5d7c3d843a Mon Sep 17 00:00:00 2001 From: Tim Schneeberger Date: Tue, 23 May 2023 19:16:36 +0200 Subject: [PATCH] fix: Handle missing MediaProjection APIs --- .../rootlessjamesdsp/activity/MainActivity.kt | 8 +++++++- app/src/main/res/values/strings.xml | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/me/timschneeberger/rootlessjamesdsp/activity/MainActivity.kt b/app/src/main/java/me/timschneeberger/rootlessjamesdsp/activity/MainActivity.kt index bbf56e5e1..e3fab36b0 100644 --- a/app/src/main/java/me/timschneeberger/rootlessjamesdsp/activity/MainActivity.kt +++ b/app/src/main/java/me/timschneeberger/rootlessjamesdsp/activity/MainActivity.kt @@ -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() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6ae34aa40..afb29b580 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -66,6 +66,7 @@ No Activity found to handle action Allowed Not allowed + Your device manufacturer has disabled the internal audio recording APIs. This application cannot work without them. Toggle audio processing