HERE Android SDK Developer's Guide

VoiceCatalog

The class VoiceCatalog is a member of com.here.android.mpa.guidance .

Class Summary

public final class VoiceCatalog

extends java.lang.Object

Manages the voice catalog used to download new voice skins.

[For complete information, see the section Class Details]

Nested Class Summary

Table 1. Nested Classes in VoiceCatalog
Nested Classes

public static final enumeration VoiceCatalog.Error

Error codes for VoiceCatalog.OnDownloadDoneListener.

public static abstract interface VoiceCatalog.OnDownloadDoneListener

Callback from report that the voice catalog/package download is done

public static abstract interface VoiceCatalog.OnProgressListener

Callback to report the catalog/package download progress.

Field Summary

Table 2. Fields in VoiceCatalog
Fields

public static final int ID_BEEPS_VIBRATE

Pass this to getLocalVoiceSkin(long) to get the locally deployed skin for beeps and vibration.

Method Summary

Table 3. Methods in VoiceCatalog
Methods

public void cancel ()

Cancels any current downloads

public boolean deleteVoiceSkin (long id)

Deletes a voice skin by voice skin id from the file system Once deletion is complete the voice catalog is refreshed

public boolean deleteVoiceSkin (VoiceSkin skin)

Deletes a voice skin from the file system.

public boolean downloadCatalog (OnDownloadDoneListener listener)

Start downloading the catalog for the current device locale language.

public boolean downloadVoice (long id, OnDownloadDoneListener listener)

Start downloading voice package with given identifier.

public java.util.List <VoicePackage> getCatalogList ()

Get the voice package description from the local catalog.

public static VoiceCatalog getInstance ()

Get access to the VoiceCatalog Singleton.

public VoiceSkin getLocalVoiceSkin (long id)

Get the voice using a specific identifier from the local storage.

public java.util.List <VoiceSkin> getLocalVoiceSkins ()

Get the voice list from the local storage.

public boolean isDownloading ()

Checks if the VoiceCatalog is downloading

public boolean isLocalCatalogAvailable ()

Check if the voice catalog for the current device locale is available in local storage.

public boolean isLocalVoiceSkin (long id)

Check if voice skin with given id is locally stored.

public void refreshVoiceSkins ()

Method to refresh the list of voice skins on the file system Note: If there are any pending downloads, it will be cancelled before the list is refreshed.

public void setOnProgressEventListener (OnProgressListener listener)

Register VoiceCatalog download progress listener.

Class Details

Manages the voice catalog used to download new voice skins.

Field Details

public static final int ID_BEEPS_VIBRATE

Pass this to getLocalVoiceSkin(long) to get the locally deployed skin for beeps and vibration. The beeps and vibration skin is not part of the online catalog.

Method Details

public void cancel ()

Cancels any current downloads

public boolean deleteVoiceSkin (long id)

Deletes a voice skin by voice skin id from the file system Once deletion is complete the voice catalog is refreshed

Parameters:

  • id

    The Id of the Voice Skin to be deleted

Returns:

true if voice skin is successfully deleted, false otherwise.

public boolean deleteVoiceSkin (VoiceSkin skin)

Deletes a voice skin from the file system. Once deletion is complete the voice catalog is refreshed

Parameters:

Returns:

true if successful, false otherwise

public boolean downloadCatalog (OnDownloadDoneListener listener)

Start downloading the catalog for the current device locale language. Catalog file is then stored locally for future access.

Parameters:

  • listener

    Download completion listener.

Returns:

true if download initialization is successful, otherwise false is returned. Use isDownloading() to check if there is already an outstanding voice catalog download request that causes false to be returned.

See also:

isDownloading()

public boolean downloadVoice (long id, OnDownloadDoneListener listener)

Start downloading voice package with given identifier. Note: only one voice package download at time is possible.

Parameters:

  • id

    Voice package identifier.

  • listener

    Download completion listener.

Returns:

true if download is initialized successfully. false otherwise.

public java.util.List <VoicePackage> getCatalogList ()

Get the voice package description from the local catalog. If no catalog matching the device's current locale is present, the list of voice package(s) in the most recently used local voice catalog will be returned instead. In the event this last known local voice catalog is not available, an empty list will be returned.

When device locale is changed, user must call refreshVoiceSkins() to reload the voice catalog that adheres to the new locale language. If the voice catalog associated with the new locale language is not available locally, this method will default back to the most recently used local catalog. Therefore, users are recommended to check if there is a local catalog available of the device's current locale by calling isLocalCatalogAvailable(). If the local catalog is unavailable, call downloadCatalog(OnDownloadDoneListener) to download of the voice catalog for the new locale language.

Occasionally, an existing catalog can also become obsolete and returns an empty voice package List . This will require the download of the voice catalog again.

Returns:

A List of VoicePackage objects. An empty List can be returned.

See also:

downloadCatalog(OnDownloadDoneListener)

setMapDisplayLanguage(Locale)

public static VoiceCatalog getInstance ()

Get access to the VoiceCatalog Singleton.

Returns:

VoiceCatalog instance

Throws:

  • AccessControlException

    Access to this operation is denied. Contact your HERE representative for more information.

public VoiceSkin getLocalVoiceSkin (long id)

Get the voice using a specific identifier from the local storage. If no voice with the identifier is present, an null reference is returned.

Parameters:

  • id

    VoiceSkin identifier.

Returns:

VoiceSkin if found. Null otherwise.

public java.util.List <VoiceSkin> getLocalVoiceSkins ()

Get the voice list from the local storage. If no voice is present an empty array is returned

Returns:

Array of VoiceSkin objects (can be empty).

public boolean isDownloading ()

Checks if the VoiceCatalog is downloading

Returns:

True if downloading, false otherwise.

public boolean isLocalCatalogAvailable ()

Check if the voice catalog for the current device locale is available in local storage. If not, user can download it using downloadCatalog(OnDownloadDoneListener).

Returns:

true if the voice catalog is available in local storage. false otherwise.

public boolean isLocalVoiceSkin (long id)

Check if voice skin with given id is locally stored.

Parameters:

  • id

    Voice skin identifier.

Returns:

True if voice skin with given id is locally stored.

public void refreshVoiceSkins ()

Method to refresh the list of voice skins on the file system Note: If there are any pending downloads, it will be cancelled before the list is refreshed. After calling this function, clients can get the updated catalog list by calling getCatalogList()

public void setOnProgressEventListener (OnProgressListener listener)

Register VoiceCatalog download progress listener.

Parameters:

  • listener

    Download progress listener.