XAMARIN SPEECH RECOGNITION API

MOON 60 Reputation points
2025-04-30T12:44:43.4266667+00:00

There is an API whose package name is android.speech in Android SDK. It converts speech to text through preinstalled Google application in Android phones. I wonder whether Xamarin Forms SDK has an API counterpart of android.speech or not.

Developer technologies | .NET | Xamarin
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Starry Night 30 Reputation points
    2025-07-25T03:29:36.1266667+00:00

    Yes, there is such functionality of Android Speech on Xamarin.

    For this, you can refer to this document: Android Speech.

    Before using the speech system, it is always wise to check to ensure the device has a microphone.

    The code sample below demonstrates querying if a microphone is available and if not, to create an alert. If no microphone is available at this point you would either quit the activity or disable the ability to record the speech.

    string rec = Android.Content.PM.PackageManager.FeatureMicrophone;
    if (rec != "android.hardware.microphone")
    {
        var alert = new AlertDialog.Builder(recButton.Context);
        alert.SetTitle("You don't seem to have a microphone to record with");
        alert.SetPositiveButton("OK", (sender, e) =>
        {
            return;
        });
        alert.Show();
    }
    

    For more information, please check the document above.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.