Class BaseSpeechKit

ru.yandex.speechkit

java.lang.Object ⇽ BaseSpeechKit

package  class  BaseSpeechKit 

Direct Known Subclasses:
SpeechKit

Singleton class that is used to configure and control the SpeechKit operation.

SpeechKit objects do not need to be created or destroyed explicitly. To access an object, use the getInstance () method that creates an object of the SpeechKit class when called for the first time. This object is destroyed when the app closes.

Nested Classes

Methods

StringgetApiKey()

Returns the API key.

android.content.ContextgetContext()

Returns the application context.

StringgetDeviceId()

Returns the device ID.

StringgetDumpPath()

Returns the path to the dump files.

EventLoggerImplgetEventLogger()

Returns an external handler for the interface event log.

LocationProvidergetLocationProvider()

Returns an object of the LocationProvider class.

StringgetUuid()

Returns the uuid.

StringgetVersion()

Returns the SpeechKit library version.

voidinit(@NonNull final android.content.Context context, @NonNull final String apiKey)

Initializes the SpeechKit library.

voidinit(@NonNull final android.content.Context context, @NonNull final String apiKey, @NonNull final LocationProvider locationProvider)

Initializes the SpeechKit library (depending on access to geolocation).

voidsetDeviceId(@NonNull String deviceUuid)

Sets the unique device ID.

voidsetDumpPath(@NonNull final String value)

Sets the path for dump files during debugging.

voidsetEventLogger(@Nullable EventLogger value)

Sets an external handler for the interface event log.

voidsetLogLevel(final LogLevel logLevel)

Sets the logging level.

voidsetUuid(@NonNull final String uuid)

Sets the uuid.

Method Detail

getApiKey

public String getApiKey ()

Returns the API key.

Returns:

The API key.

getContext

public android.content.Context getContext ()

Returns the application context.

Returns:

Application context.

getDeviceId

public String getDeviceId ()

Returns the device ID.

Returns:

Device ID.

getDumpPath

public String getDumpPath ()

Returns the path to the dump files.

Returns:

Current path to the dump files.

getEventLogger

public EventLoggerImpl getEventLogger ()

Returns an external handler for the interface event log.

Returns:

External handler for the interface event log.

getLocationProvider

public LocationProvider getLocationProvider ()

Returns an object of the LocationProvider class.

Returns:

An object of the LocationProvider class.

getUuid

public String getUuid ()

Returns the uuid.

Returns:

Unique user ID. The UUID must be the same for all requests sent to a particular app on a specific device.

getVersion

public static String getVersion ()

Returns the SpeechKit library version.

Returns:

SpeechKit library version.

init

public void init (@NonNull final android.content.Context context, @NonNull final String apiKey)

Initializes the SpeechKit library.

The method should be called before using any of the SpeechKit functionality (before creating objects of the Recognizer class and others). The API key is verified when working with the server (for example, during initialization). The key validation process may finish with the ERROR_INVALID_API_KEY error.
Parameters:
context

Application context.

apiKey

The API key provided by Yandex.

Throws:

LibraryInitializationException

Exceptions are thrown when there are problems loading the native part of the library.

init

public void init (@NonNull final android.content.Context context, @NonNull final String apiKey, @NonNull final LocationProvider locationProvider)

Initializes the SpeechKit library (depending on access to geolocation).

The method should be called before using any of the SpeechKit functionality (before creating objects of the Recognizer class and others). The API key is verified when working with the server (for example, during initialization). The key validation process may finish with the ERROR_INVALID_API_KEY error.
Note.

If SpeechKit was configured by calling a different version of the init(Context, String) method, the default values will be used for working with geolocation.

Parameters:
context

Application context.

apiKey

The API key provided by Yandex.

locationProvider

Object that gives the library access to geolocation. Information about the user's current location may be used for determining the most likely hypotheses, for example, when using the MAPS language model.

Throws:

LibraryInitializationException

Exceptions are thrown when there are problems loading the native part of the library.

setDeviceId

public void setDeviceId (@NonNull String deviceUuid)

Sets the unique device ID.

The ID must be the same for all requests from a particular app on a particular device.

setDumpPath

public void setDumpPath (@NonNull final String value)

Sets the path for dump files during debugging.

The default value is an empty string.
Note.

If the value is an empty string, no dump files are written.

Parameters:
value

Full path to the dump files. Default value: empty string.

setEventLogger

public void setEventLogger (@Nullable EventLogger value)

Sets an external handler for the interface event log.

Sets a handler for messages about user actions with the interface (the list of messages is determined by the EventLogger interface).
Parameters:
value

User actions' log handler that implements the EventLogger interface.

setLogLevel

public void setLogLevel (final LogLevel logLevel)

Sets the logging level.

Parameters:
logLevel

Logging level.

setUuid

public void setUuid (@NonNull final String uuid)

Sets the uuid.

It is unique for each user of the app or service. The value of this field is passed to all SpeechKit requests. Used for tracking sessions of individual users and apps. The value should be generated the first time the app is launched on the device and stored in permanent storage. Subsequent runs of the app should use the saved value.
Parameters:
uuid

The uuid value for the installation.