Class KASRUploader

java.lang.Object
com.keenresearch.keenasr.KASRUploader

public class KASRUploader extends Object
KASRUploader class provides methods that manage uploads of speech recognition metadata and audio recordings to Dashboard, a Keen Research cloud service for data collection and development of voice applications. For more details see http://keenresearch.com.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Creates a background thread which periodically scans recognizer data directory and uploads audio recordings and speech recognition metadata to Dashboard, a Keen Research cloud service.
    static boolean
    Pause uploads in already created upload thread.
    static boolean
    Resume uploads in already created upload thread.
    static boolean
    Stops data uploader background thread.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KASRUploader

      public KASRUploader()
  • Method Details

    • createDataUploader

      public static boolean createDataUploader(KASRRecognizer recognizer, String appKey)
      Creates a background thread which periodically scans recognizer data directory and uploads audio recordings and speech recognition metadata to Dashboard, a Keen Research cloud service. Data will be uploaded to the cloud service using the specified appKey.

      For more details see http://keenresearch.com/dashboard

      Parameters:
      recognizer - recognizer for which recordings and metadata will be uploaded
      appKey - app key provided for your app via Dashboard cloud service
      Returns:
      true if upload thread was successfully created, false otherwise.

      If provided appKey cannot be matched via cloud API, upload requests will be ignored.

      For a response to be uploaded to Dashboard you first need to queue if for upload using KASRResponse.queueForUpload() method. After a successful upload, uploader thread will remove the data from the local directory. In order to create the instance of the data uploader your app needs to have the following permissions: android.permission.INTERNET, android.permission.ACCESS_NETWORK_STATE.

      Uploader will currently upload data as long as there is internet connectivity regardless of its type (WiFi, LTE, etc.). Your application can pause/resume the uploader thread based on the type of connectivity that's available.

    • pause

      public static boolean pause()
      Pause uploads in already created upload thread. If upload thread was not created prior to calling this method, the call to this method will be ignored. Once uploads have* been paused they can be resumed at any time by calling resume.
      Returns:
      True if successful, false otherwise.
    • resume

      public static boolean resume()
      Resume uploads in already created upload thread.
      Returns:
      true if uploads successfully resumed (data upload thread has been created prior to calling this method), false if uploads cannot be resumed.
    • stop

      public static boolean stop()
      Stops data uploader background thread.
      Returns:
      true if uploader thread is stopped. False if uploader thread was not created and thus it cannot be stopped.