Skip to content

Commit 11e036e

Browse files
committedDec 26, 2019
Support requesting Do Not Disturb access
The respective permission is declared in the manifest and a shortcut to the respective settings is in the Kõnele developer menu. It seems that this would only be needed if Kõnele is used while background audio is playing and the app that plays it ignores the request to pause it. Having access to Do Not Disturb setting allows us to mute the audio stream (on N and higher). This has always seemed to work on the phone, but crashes on TV if Do Not Disturb access was not granted.
1 parent d63f8ea commit 11e036e

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed
 

‎app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ android {
2020
applicationId 'ee.ioc.phon.android.speak'
2121
minSdkVersion 16
2222
targetSdkVersion 29
23-
versionCode 1711
24-
versionName '1.7.11'
23+
versionCode 1712
24+
versionName '1.7.12'
2525
}
2626

2727
compileOptions {

‎app/src/main/AndroidManifest.xml

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
-->
3838
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
3939

40+
<!-- TODO: investigate if we need this permission (and enable it during runtime), to
41+
mute the audio stream during recognition. -->
42+
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
43+
4044
<!-- Custom permission required by GetPutPreferenceActivity to be able to read/write the Kõnele settings. -->
4145
<!--
4246
<uses-permission android:name="ee.ioc.phon.android.speak.permission.GET_PUT_SETTING" />

‎app/src/main/res/xml/preferences.xml

+6
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,12 @@
221221
android:targetClass="ee.ioc.phon.android.speak.demo.ImeListDemo"
222222
android:targetPackage="ee.ioc.phon.android.speak" />
223223
</Preference>
224+
<!-- TODO: localize -->
225+
<Preference
226+
android:summary="Switch on if background audio does not stop during recognition"
227+
android:title="Do Not Disturb access">
228+
<intent android:action="android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS" />
229+
</Preference>
224230
</PreferenceCategory>
225231
</PreferenceScreen>
226232
</PreferenceCategory>

0 commit comments

Comments
 (0)
Failed to load comments.