Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide voice input if service not available #5904

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

parneet-guraya
Copy link
Contributor

Fixes #5698

What changes did you make and why?

  • Query on app startup if speech service is enable/available or not.
  • Using that flag to set visibility of voice input icon.

Tests performed (required)

Tested {betaDebug prodDebug} on Oneplus 9RT, Android 14

Steps to test:

  • Go to phone's settings and then to Apps
  • find speech service by searching for speech
  • try enable/disable
  • restart app after every enable/disable.

@parneet-guraya parneet-guraya force-pushed the hide-voice-input-when-not-available branch 2 times, most recently from 3bf48a8 to b6641e7 Compare October 27, 2024 14:38
@nicolas-raoul
Copy link
Member

Testing now, it is working fine on my device that has voice input.
I will search for a device that does not have voice input.

@parneet-guraya
Copy link
Contributor Author

You can also disable the speech service :)

Record_2024-10-28-08-05-19.mp4

@nicolas-raoul
Copy link
Member

nicolas-raoul commented Oct 28, 2024

Nice tip!

I actually tried with my Galaxy 10, on Android 9, and somehow it shows the microphone despite having no voice recognition capabilities as far as I know:

PXL_20241028_072059556.mp4

Any idea what could be the issue?

* Flag to check if speech recognition is available.
*/
val isVoiceRecognitionAvailable by lazy {
SpeechRecognizer.isRecognitionAvailable(this)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're depending on this call to check if service is available or not. Since, I don't have access to the device, do you mind adding a print statement and see if it returns true, then likely issue is with API.

@parneet-guraya
Copy link
Contributor Author

parneet-guraya commented Oct 28, 2024

Also try logging in the catch block too, on the click.

For me when I disable service I get this exception message.

No Activity found to handle Intent { act=android.speech.action.RECOGNIZE_SPEECH (has extras) }

Copy link
Member

@nicolas-raoul nicolas-raoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind rebasing? Thanks!

Also, could everyone test with their phones and report the results? Thanks! :-)

@parneet-guraya
Copy link
Contributor Author

Sure

Signed-off-by: parneet-guraya <gurayaparneet@gmail.com>
@parneet-guraya parneet-guraya force-pushed the hide-voice-input-when-not-available branch from b6641e7 to 471716e Compare December 18, 2024 07:15
@parneet-guraya
Copy link
Contributor Author

Also, could everyone test with their phones and report the results? Thanks! :-)

Yes, could you see if it works for you (try to use any physical device you have especially if older) @neeldoshii @savsch @sonalyadav1

Thanks!!

@neeldoshii
Copy link
Contributor

Yes, could you see if it works for you (try to use any physical device you have especially if older) @neeldoshii @savsch @sonalyadav1

Sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Voice input icon should be shown only when corresponding services are available
3 participants