OneTok Titanium Module

Looking to include voice recognition in your Titanium app? You can use the OneTok service and the Titanium module to add this feature into your Titanium project in just a couple lines of code.

What is OneTok?

OneTok provides developers with a simple and flexible infrastructure for building voice recognition controls into mobile apps.

To learn more please visit them here and review their documentation here.

The Titanium Module

The Ti.OneTok module provides a wrapper around the OneTok SDK allowing you to call it from your Titanium Project.  The Ti.OneTok module is available for download from the github project.

You can download the compiled iOS module here.  Documentation is available for the iOS module here.

The Code

The complete code, documentation, and example app.js is available for download ongithub here.

Ti.OneTok is available under the Apache 2 license so feel free to fork, extended, and contribute.

An Example

A full demonstration app.js is available in the module’s example folder.

Below shows how to authenticate and tell OneTok which grammar to use.

//Sample demonstrating how to authenticate a Ti.OneTok Session
function authenticateSession(){
    function onError(e){
        //We encountered an error, provide the details;
        alert('Errored on Authentication');
    function onSuccess(e){
        //Login was successful
        alert('Authenticated Successfully');
        alert("I'm sorry a network connection is needed to use this module");
                appID : "YOUR_APP_ID_GOES_HERE",
                appToken : "YOUR_APP_TOKEN_GOES_HERE",
                version : "0.1",
                onSuccess:onSuccess, //Called when authentication is successful
                onError:onError //Called on authentication error        

The below shows how to start recording.

function startRecording(){
    var oneTokOutput = [];
    //This method is called on error
    function onError(e){;
        alert('Errored while recording');
    //This method is called as OneTok processes your
    //speak results. This will be called several times before finish
    function onResults(e){"results=" + JSON.stringify(e));
        //We add the pending results to be used later.
        //You can check the result_type to determine if 
        //a valid result has been returned
  "Valid Results=" + JSON.stringify(e));  
    //This method is called when the recording session has finished
    function onFinish(e){
        alert('Recording Completed');;
        alert("I'm sorry a network connection is needed to use this module");
                onResults:onResults, //Add callback to process results, called many times 
                onError:onError, //Add callback to handle error messages
                onFinish:onFinish  //Add callback to handle when recording has finished


  • Is there an Android version? – Coming soon
  • How do I start using OneTok? – OneTok requires an API key, please register at and follow their get started tutorial.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s