Android 11을 대상으로 할 때 SpeechRecognizer를 사용할 수 없음
Oct 12 2020
(30)에 targetLevel을 증가 후 응용 프로그램을 테스트하는 동안, 나는 것을 발견 SpeechRecognizer은 즉, 더 이상 사용할 수 없습니다 SpeechRecognizer.isRecognitionAvailable()항상 false를 돌려줍니다.
아무것도 변경하지 않고 targetLevel을 다시 29로 설정하면 다시 사용할 수 있습니다. 이것은 실제 기기 (Pixel 3a)와 에뮬레이터에서 발생합니다.
그것은 행동 변화 가 아닌 것 같습니다 . Recognizer API에서 언급하는 유일한 요구 사항은Manifest.permission.RECORD_AUDIO
나는 또한 logcat에서 단서를 찾지 못했습니다.
답변
11 bwt Oct 13 2020 at 08:41
마침내 해결책을 찾았습니다.
실제로 (사용할 수 없음) 인식기를 사용하려고하면 logcat에 다음 메시지가 표시됩니다.
10-13 09:19:50.273 1531 1799 I AppsFilter: interaction: PackageSetting{eb6a1b2 my.application.package/10225} -> PackageSetting{ab34503 com.google.android.googlequicksearchbox/10140} BLOCKED
10-13 09:19:50.273 1531 1799 W ActivityManager: Unable to start service Intent { act=android.speech.RecognitionService cmp=com.google.android.googlequicksearchbox/com.google.android.voicesearch.serviceapi.GoogleRecognitionService } U=0: not found
10-13 09:19:50.273 25348 25348 E SpeechRecognizer: bind to recognition service failed
따라서 문제는이 새로운 Android 11 '기능' 과 관련된 것으로 보이며 해결책은 차단 된 의도에 대한 쿼리를 매니페스트에 추가하는 것이 었습니다.
<manifest ...>
<queries>
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>
</queries>