ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Speech Recognition functions
  • Special cases
  • Application in the background: Specific case from Android 10
  • Required permissions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Triggers the device's speech recognition service.
Note: This function can be used in the emulator. This function cannot be used in the simulator.
Example
// Affichage des propositions retournées par le service de reconnaissance vocale dans un champ Liste
MaListe is string 
MaListe = SpeechRecognitionTrigger("Je vous écoute ...")
IF ErrorOccurred = False THEN
	FOR EACH STRING Proposition OF MaListe SEPARATED BY CR
		ListAdd(LISTE_ListeProposition, Proposition)
	END
END
Syntax

Triggering the speech recognition service (synchronous mode) Hide the details

<Result> = SpeechRecognitionTrigger([<Text>])
<Result>: Character string
  • List of words or sentences proposed by the speech recognition service based on the words pronounced by the user. Each proposition is separated by a CR character (Carriage Return).
  • Empty string ("") in the following cases:
    • if the speech recognition was canceled by the user.
    • if an error occurred.
    • if no match was found by the speech recognition service.
    In this case, the ErrorOccurred variable is set to True. To get more details on the error, use ErrorInfo.
<Text>: Optional character string
Text that will appear in the window displayed by the speech recognition service. This window blocks the application.
iPhone/iPadMac Catalyst

Triggering the speech recognition service (asynchronous mode) Hide the details

SpeechRecognitionTrigger([<Text>, ] <WLanguage procedure>)
<Text>: Optional character string
Text that will appear in the window displayed by the speech recognition service. This window does not block the application.
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure ("callback") called to run speech recognition. This procedure is used to get the proposed words or sentences. For more details on this procedure, see Parameters of the procedure used by SpeechRecognitionTrigger.
Remarks

Special cases

  • SpeechRecognitionTrigger uses the device's speech recognition service. The function will fail if this service is not available.
  • When speech recognition is triggered, a window is opened to notify the user of the start and end of the speech recognition session as well as the progress of the process.
    • Syntax 1: The function SpeechRecognitionTrigger is blocking as long as this window is displayed.
    • iPhone/iPadMac Catalyst Syntax 2: The SpeechRecognitionTrigger function is not blocking as long as this window is displayed. Propositions are processed in a WLanguage procedure.
  • If one of the propositions returned by the speech recognition service corresponds to a command added to the current window by SpeechRecognitionAddCommand, the WLanguage procedure corresponding to this command will be executed.
  • Attention The function SpeechRecognitionTrigger function requires an Internet connection and cannot be used in offline mode.
  • iPhone/iPad This function can be used from iOS 10.
AndroidAndroid Widget

Application in the background: Specific case from Android 10

Starting with Android 10, it is no longer possible to open a window when the application is in the background.
SpeechRecognitionTrigger can open a window. If this function is used while the application is in the background, a fatal error will occur.
Tips:
  • It is possible to determine if the application is in the background using InBackgroundMode.
  • If an application needs to interact with the user while it is in the background, the solution is to display a notification (via the Notification type). The application will be brought back to the foreground when the notification is clicked, if the ActivateApplication property is set to True. You can also open a window from the procedure passed to the ActionClick property.
AndroidAndroid Widget

Required permissions

This function changes the permissions required by the application.
Permission required: INTERNET: this permission allows applications to open network sockets.
Related Examples:
Android Speech Synthesis Android (WINDEV Mobile): Android Speech Synthesis
[ + ] This educational example explains how to manage the recognition and the speech synthesis Android.
The speech synthesis is performed by using either the WLanguage functions, or an external JAR file included in the WINDEV Mobile project.
Business / UI classification: UI Code
Component: wd300android.aar
Minimum version required
  • Version 17
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help