plyer: Plyer stt not working on my android device
I have build a kivy app to android apk with kivy following the example from this source (https://github.com/kivy/plyer/blob/master/examples/speech2text/main.py)
the app is working good by when I click the button the plyer is not showing any output.
As per the following code https://github.com/kivy/plyer/blob/master/plyer/facades/stt.py “after execute start
method you can hear BEEP!” , but I am not able to hear anything even though My device microphone works fine
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 19 (8 by maintainers)
yes, i think adding check_permission/ask_permission code in each android plyer module would make sense, the dev can still ask beforehand if they don’t want users to be asked each permission independently.
Now I got the answer whoever has the same problem you can use this repo https://github.com/AM-ash-OR-AM-I/SR/blob/main/main.py that I forked from https://github.com/Abhishek-op/SR basically I added the dialog asking for microphone permission to user…
i started implementing a
require_permissions
decorator on my side, to transparently request the permissions before calling the actual method if all the permissions haven’t been set already, i still need to test it a bit more, and there are subtleties that could make that route harder to ride than i expected, but i think it can work.request_permissions()
generates Android pause/resume events. Called during Kivybuild()
this is not an issue. Called during Kivyon_start()
the pause occurs duringon_start
(not an issue) but a Kivyon_resume()
is generated at a later time. This is an issue because the app code will see anon_resume()
with no prioron_pause()
. It is reasonable to expect a pause/resume pair, and is commonly used in setting app state; but this assumption can lead to unexpected behavior in therequest_permissions()
case.Here are my original experiments https://github.com/kivy/python-for-android/issues/2309 Given the documentation the issue may be Kivy specific,
on_start()
quite reasonably inhibiting the generation of anon_pause()
. In which case my ‘must be inbuild()
’, should be ‘must not be inon_start()
’. I prefer documenting the former.Separately, multiple calls to
request_permissions()
can lead to a single dialog with missing approvals, in the one test case I looked at (Xcamera + user specified permission) the missing permissions were automatically approved. That was enough I did not dig deeper. Given the documents, perhaps the issue is overlapping calls. User transparent calls ofrequest_permissions()
have the potential to be overlapping and lead to unexpected behavior.Bottom line: there can be undocumented side effects, testing is required.
Thanks for listening to my 2 cents worth.
yes I actually added this small code in my main.py