kivy / plyer

Plyer is a platform-independent Python wrapper for platform-dependent APIs
https://plyer.readthedocs.io
MIT License
1.61k stars 427 forks source link

Speech to text is not working with api 30 or more #693

Closed KINGMOHIT closed 2 years ago

KINGMOHIT commented 2 years ago

I tested plyer sst for various devices with api version 31 and it worked fine in devices with Android 9 or less but with Android 10 or more it doesn't enabled microphone. May be the issue is that microphone is not working

HyTurtle commented 2 years ago

Is there anything reported in the logcat that can be addressed?

KINGMOHIT commented 2 years ago

07-15 00:40:34.816 1565 2456 I AppsFilter: interaction: PackageSetting{8dccecb oli.oli/10402} -> PackageSetting{f1e9383 com.google.android.googlequicksearchbox/10219} BLOCKED 07-15 00:40:34.816 1565 2456 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 07-15 00:40:34.817 32341 32341 E SpeechRecognizer: bind to recognition service failed 07-15 00:40:35.253 1088 1619 D AudioAnalytics: gc(1700, 2000): log size:1700 item map size:7, item map items:1700 07-15 00:40:35.320 18772 2464 D HeadsetPhoneState: sendDeviceStateChanged. mService=1 mSignal=3 mRoam=0 mBatteryCharge=3 No nothing. But the way I tested it the problem is with api version 30+ APIs are not supported for stt.

KINGMOHIT commented 2 years ago

https://github.com/Android-for-Python/Android-for-Python-Users#plyer I just find out this ... Please look into it. I worked for 8 months straight and at the end moment while submitting the app to console. I understood the problem

KINGMOHIT commented 2 years ago

https://stackoverflow.com/questions/64319117/speechrecognizer-not-available-when-targeting-android-11

HyTurtle commented 2 years ago

If it is just that query that needs added then that could potentially be added/provided via extra_manifest_xml in buildozer/p4a. plyer isn't really setup to automatically provide/inject such files - other than say suggesting that param (if it does sort it) in the examples; so could probably close the issue.

KINGMOHIT commented 2 years ago

This is may be off topic but I am getting error Open quote is expected for attribute "android:name" associated with an element type "action". in buildozer. I just copy pasted those xml codes

HyTurtle commented 2 years ago

Can you show precisely what you copied/ran and where you are getting that error

<queries>
    <intent>
        <action android:name="android.speech.RecognitionService" />
    </intent>
</queries>

should be what you're adding/including

KINGMOHIT commented 2 years ago

Execution failed for task ':generateReleaseBuildConfig'. org.xml.sax.SAXParseException; systemId: file:/mnt/e/New/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/Oli/src/main/AndroidManifest.xml; lineNumber: 45; columnNumber: 30; Open quote is expected for attribute "android:name" associated with an element type "action".

above is the exact error

I have attached my xml file in txt format and in buildozer android.extra_manifest_xml =z.xml z.txt

KINGMOHIT commented 2 years ago

also the file in which it is giving error AndroidManifest.txt e

HyTurtle commented 2 years ago

seems to have removed the quotes... what happens if you escape them? android:name=\"android.speech.RecognitionService\"

failing that try manually adding it to the template

KINGMOHIT commented 2 years ago

No doesn't work

HyTurtle commented 2 years ago

escaping the characters does seem to build correctly here;

    <queries>
            <intent>
                <action android:name=\"android.speech.RecognitionService\" />
            </intent>
        </queries>
KINGMOHIT commented 2 years ago

thanks above code solves the issue

znerl commented 2 years ago

for me that doesn't work...

trying to get this code running:

main.py:

main.py

adding this to buildozer.spec :

android.extra_manifest_xml = z.xml

z.xml : `

    </queries>`

Nothing happens just [] is written in the results