Skip to content

Commit 563b258

Browse files
committedSep 21, 2021
Move services to a separate process
This solves the long-standing permission issue on Android 11 (#82). Solution from https://stackoverflow.com/questions/69186724/recognitionservice-call-for-recognition-service-without-record-audio-permission
1 parent e533d0a commit 563b258

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed
 

‎app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ android {
2727
applicationId 'ee.ioc.phon.android.speak'
2828
minSdkVersion 21
2929
targetSdkVersion 30
30-
versionCode 1807
31-
versionName '1.8.07'
30+
versionCode 1809
31+
versionName '1.8.09'
3232
vectorDrawables.useSupportLibrary = true
3333
// Keep only en and et resources
3434
resConfigs "en", "et"

‎app/src/main/AndroidManifest.xml

+5-2
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,16 @@ Also, failed to set the launchMode from the resource, INSTALL_PARSE_FAILED_UNEXP
406406

407407
<!-- This service is exported, i.e. any app can call K6nele, but needs to have recording-permission. -->
408408
<!-- TODO: why can't I specify more permissions here? -->
409+
<!-- Setting the process here solves the permission issue on Android 11. -->
409410
<service
410411
android:name=".service.WebSocketRecognitionService"
411412
android:description="@string/summaryServiceWs"
412413
android:exported="true"
413414
android:foregroundServiceType="microphone"
414415
android:icon="@drawable/ic_service"
415416
android:label="@string/labelRecognitionServiceWs"
416-
android:permission="android.permission.RECORD_AUDIO">
417+
android:permission="android.permission.RECORD_AUDIO"
418+
android:process=":service">
417419
<intent-filter>
418420

419421
<!-- The constant value is defined at RecognitionService.SERVICE_INTERFACE. -->
@@ -439,7 +441,8 @@ Also, failed to set the launchMode from the resource, INSTALL_PARSE_FAILED_UNEXP
439441
android:foregroundServiceType="microphone"
440442
android:icon="@drawable/ic_service"
441443
android:label="@string/labelRecognitionServiceHttp"
442-
android:permission="android.permission.RECORD_AUDIO">
444+
android:permission="android.permission.RECORD_AUDIO"
445+
android:process=":service">
443446
<intent-filter>
444447

445448
<!-- The constant value is defined at RecognitionService.SERVICE_INTERFACE. -->

0 commit comments

Comments
 (0)
Failed to load comments.