|
| 1 | +--- |
| 2 | +title: Getting Started |
| 3 | +page_title: .NET MAUI SpeechToTextButton Documentation - Getting Started |
| 4 | +description: Get started with the Telerik UI for .NET MAUI SpeechToTextButton control and add the control to your .NET MAUI project. |
| 5 | +position: 2 |
| 6 | +slug: speechtotextbutton-getting-started |
| 7 | +--- |
| 8 | + |
| 9 | +# Getting Started with the .NET MAUI SpeechToTextButton |
| 10 | + |
| 11 | +This guide provides the information you need to start using the Telerik UI for .NET MAUI SpeechToTextButton by adding the control to your project. |
| 12 | + |
| 13 | +At the end, you will achieve the following result. |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +## Prerequisites |
| 18 | + |
| 19 | +Before adding the SpeechToTextButton, you need to: |
| 20 | + |
| 21 | +1. [Set up your .NET MAUI application]({%slug maui-getting-started%}#prerequisites). |
| 22 | + |
| 23 | +1. [Download Telerik UI for .NET MAUI]({% slug maui-getting-started%}#step-0-start-your-free-trial). |
| 24 | + |
| 25 | +1. [Install Telerik UI for .NET MAUI]({%slug maui-getting-started%}#step-3-add-the-telerik-nuGet-server). |
| 26 | + |
| 27 | +## Required Permissions |
| 28 | + |
| 29 | +Before adding the contol, ensure that you have the required permissions set up in your project. |
| 30 | + |
| 31 | +### Android |
| 32 | + |
| 33 | +Add the following permissions to your `AndroidManifest.xml` file: |
| 34 | + |
| 35 | +```xml |
| 36 | +<uses-permission android:name="android.permission.RECORD_AUDIO" /> |
| 37 | +``` |
| 38 | + |
| 39 | +### iOS and MacCatalyst |
| 40 | + |
| 41 | +Add the `NSMicrophoneUsageDescription` and `NSSpeechRecognitionUsageDescription` permissions to your `Info.plist` file: |
| 42 | + |
| 43 | +```xml |
| 44 | +<key>NSMicrophoneUsageDescription</key> |
| 45 | +<string>The SpeechToTextButton requires access to microphone.</string> |
| 46 | +<key>NSSpeechRecognitionUsageDescription</key> |
| 47 | +<string>The SpeechToTextButton requires access to the Speech Recognition service.</string> |
| 48 | +``` |
| 49 | + |
| 50 | +### WinUI |
| 51 | + |
| 52 | +There are limitations when using the SpeechToTextButton on WinUI. When clicking on the control, the `InvalidOperationException` occurs. |
| 53 | + |
| 54 | +To turn speech recognition on WinUI, review the [WinUI Support]({%slug speechtotextbutton-winui-support%}) article. |
| 55 | + |
| 56 | +## Define the Control |
| 57 | + |
| 58 | +**1.** When your .NET MAUI application is set up, you are ready to add a SpeechToTextButton control to your page: |
| 59 | + |
| 60 | +<snippet id='speechtotext-getting-started-xaml' /> |
| 61 | +<snippet id='speechtotext-getting-started-csharp' /> |
| 62 | + |
| 63 | +**2.** Add the `telerik` namespace: |
| 64 | + |
| 65 | +```XAML |
| 66 | +xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui" |
| 67 | +``` |
| 68 | +```C# |
| 69 | +using Telerik.Maui.Controls; |
| 70 | +``` |
| 71 | + |
| 72 | +**3.** Register the Telerik controls through the `Telerik.Maui.Controls.Compatibility.UseTelerik` extension method called inside the `CreateMauiApp` method of the `MauiProgram.cs` file of your project: |
| 73 | + |
| 74 | +```C# |
| 75 | +using Telerik.Maui.Controls.Compatibility; |
| 76 | +public static class MauiProgram |
| 77 | +{ |
| 78 | + public static MauiApp CreateMauiApp() |
| 79 | + { |
| 80 | + var builder = MauiApp.CreateBuilder(); |
| 81 | + builder |
| 82 | + .UseTelerik() |
| 83 | + .UseMauiApp<App>() |
| 84 | + .ConfigureFonts(fonts => |
| 85 | + { |
| 86 | + fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); |
| 87 | + }); |
| 88 | + return builder.Build(); |
| 89 | + } |
| 90 | +} |
| 91 | +``` |
| 92 | + |
| 93 | +> For a runnable example with the SpeechToTextButton Getting Started scenario, see the [SDKBrowser Demo Application]({%slug sdkbrowser-app%}) and go to the **SpeechToTextButton > Getting Started** category. |
| 94 | +
|
| 95 | +## Additional Resources |
| 96 | + |
| 97 | +- [Configure the SpeechToTextButton]({%slug speechtotextbutton-configuration%}) |
| 98 | +- [Set Visual States]({%slug speechtotextbutton-visual-states%}) |
| 99 | +- [Events]({%slug speechtotextbutton-events%}) |
| 100 | +- [Execute Commands]({%slug speechtotextbutton-commands%}) |
| 101 | +- [Style the SpeechToTextButton]({%slug speechtotextbutton-styling%}) |
| 102 | + |
| 103 | +## See Also |
| 104 | + |
| 105 | +- [.NET MAUI SpeechToTextButton Product Page](https://www.telerik.com/maui-ui/speechtotextbutton) |
| 106 | +- [.NET MAUI SpeechToTextButton Forum Page](https://www.telerik.com/forums/maui?tagId=1764) |
| 107 | +- [Telerik .NET MAUI Blogs](https://www.telerik.com/blogs/mobile-net-maui) |
| 108 | +- [Telerik .NET MAUI Roadmap](https://www.telerik.com/support/whats-new/maui-ui/roadmap) |
0 commit comments