Skip to content

hismaeel/VoiceItApi2AndroidSDK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A fully comprehensive SDK that gives you access to the VoiceIt's New VoiceIt API 2.0 featuring Voice + Face Verification and Identification right in your Android app.

Getting Started

Sign up for a free Developer Account at VoiceIt.io and activate API 2.0 from the settings page. Then you should be able view the API Key and Token (as shown below). You can also review the HTTP Documentation at api.voiceit.io.

API Key and Token

Installation

VoiceItApi2AndroidSDK is available through JitPack.

API Calls

Initialization

First import VoiceItAPI2 and then initialize a reference to the SDK inside an Activity, passing in the API Credentials.

import com.loopj.android.http.JsonHttpResponseHandler;
import cz.msebera.android.httpclient.Header;
import org.json.JSONObject;

import com.voiceit.voiceit2.VoiceItAPI2;

public class MainActivity extends AppCompatActivity {

    public VoiceItAPI2 myVoiceIt2;
    public Activity mActivity;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        myVoiceIt2 = new VoiceItAPI2("API_KEY","API_TOK");
        mActivity = this;
    }
}

API calls

For each API call, a JsonHttpResponseHandler is needed to receive the result of the call. You can Override the response handlers like so, and abbreviated below:

new JsonHttpResponseHandler() {
    @Override
    public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
        System.out.println("JSONResult : " + response.toString());
    }

    @Override
    public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
        if (errorResponse != null) {
            System.out.println("JSONResult : " + errorResponse.toString());
        }
    }
});

User API Calls

Get All Users

Get all the users associated with the apiKey

myVoiceIt.getAllUsers(new JsonHttpResponseHandler() {...});

Create User

Create a new user

myVoiceIt.createUser(new JsonHttpResponseHandler() {...});

Check if User Exists

Check whether a user exists for the given userId(begins with 'usr_')

myVoiceIt.getUser("USER_ID_HERE", new JsonHttpResponseHandler() {...});

Delete User

Delete user with given userId(begins with 'usr_')

myVoiceIt.deleteUser("USER_ID_HERE", new JsonHttpResponseHandler() {...});

Get Groups for User

Get a list of groups that the user with given userId(begins with 'usr_') is a part of

myVoiceIt.getGroupsForUser("USER_ID_HERE", new JsonHttpResponseHandler() {...});

Group API Calls

Get All Groups

Get all the groups associated with the apiKey

myVoiceIt.getAllGroups(new JsonHttpResponseHandler() {...});

Get Group

Returns a group for the given groupId(begins with 'grp_')

myVoiceIt.getGroup("GROUP_ID_HERE", new JsonHttpResponseHandler() {...});

Check if Group Exists

Checks if group with given groupId(begins with 'grp_') exists

myVoiceIt.groupExists("GROUP_ID_HERE", new JsonHttpResponseHandler() {...});

Create Group

Create a new group with the given description

myVoiceIt.createGroup("Sample Group Description", new JsonHttpResponseHandler() {...});

Add User to Group

Adds user with given userId(begins with 'usr_') to group with given groupId(begins with 'grp_')

myVoiceIt.addUserToGroup("GROUP_ID_HERE", "USER_ID_HERE", new JsonHttpResponseHandler() {...});

Remove User from Group

Removes user with given userId(begins with 'usr_') from group with given groupId(begins with 'grp_')

myVoiceIt.removeUserFromGroup( "GROUP_ID_HERE", "USER_ID_HERE", new JsonHttpResponseHandler() {...});

Delete Group

Delete group with given groupId(begins with 'grp_'), note: this call does not delete any users, but simply deletes the group and disassociates the users from the group

myVoiceIt.deleteGroup("GROUP_ID_HERE", new JsonHttpResponseHandler() {...});

Enrollment API Calls

Get All Enrollments for User

Gets all enrollment for user with given userId(begins with 'usr_')

myVoiceIt.getAllEnrollmentsForuser("USER_ID_HERE", new JsonHttpResponseHandler() {...});

Delete Enrollment for User

Delete enrollment for user with given userId(begins with 'usr_') and enrollmentId(integer)

myVoiceIt.deleteEnrollmentForUser( "USER_ID_HERE", "ENROLLMENT_ID_HERE", new JsonHttpResponseHandler() {...});

Create Voice Enrollment

Create audio enrollment for user with given userId(begins with 'usr_') and contentLanguage('en-US','es-ES' etc.). Note: Immediately upon calling this method it records the user saying their VoicePrint phrase for 5 seconds calling the recordingFinished callback first, then it sends the recording to be added as an enrollment and returns the result in the callback

myVoiceIt.createVoiceEnrollment("USER_ID_HERE", "CONTENT_LANGUAGE_HERE", new JsonHttpResponseHandler() {...});

Create Video Enrollment

Create video enrollment for user with given userId(begins with 'usr_') and contentLanguage('en-US','es-ES' etc.). Note: File recording need to be no less than 1.2 seconds and no more than 5 seconds

myVoiceIt.createVideoEnrollment("USER_ID_HERE", "CONTENT_LANGUAGE_HERE", File video, new JsonHttpResponseHandler() {...});

Encapsulated Video Enrollment

Create three video enrollments for user with given userId(begins with 'usr_') and contentLanguage('en-US','es-ES', etc.) and a given phrase such as "my face and voice identify me". Note: Immediately upon calling this method it displays the user and enrollment view controller that completely takes care of the three enrollments, including the UI and then provides relevant callbacks for whether the user cancelled their enrollments or successfully completed them. Also note, if less than the required enrollments exist for the user, it deletes them and reenrolls.

myVoiceIt.encapsulatedVideoEnrollUser(Activity, "USER_ID_HERE", "CONTENT_LANGUAGE_HERE",  "my face and voice identify me", new JsonHttpResponseHandler() {...});

Verification API Calls

Voice Verification

Verify user with the given userId(begins with 'usr_') and contentLanguage('en-US','es-ES' etc.). Note: Immediately upon calling this method it records the user saying their VoicePrint phrase for 5 seconds calling the recordingFinished callback first, then it sends the recording to be verified and returns the resulting confidence in the callback

myVoiceIt.voiceVerification("USER_ID_HERE", "CONTENT_LANGUAGE_HERE", new JsonHttpResponseHandler() {...});

Video Verification

Verify user with given userId(begins with 'usr_') and contentLanguage('en-US','es-ES' etc.). Note: Immediately upon calling this method it displays the camera and starts recording a video of the user saying their VoicePrint phrase for 5 seconds calling the recordingFinished callback first, then it sends the recording to be added as an enrollment and returns the result in the callback

myVoiceIt.videoVerification("USER_ID_HERE", "CONTENT_LANGUAGE_HERE", File video, new JsonHttpResponseHandler() {...});

Encapsulated Video Verification

Verify user with given userId(begins with 'usr_') and contentLanguage('en-US','es-ES' etc.). Note: Immediately upon calling this method it displays a view controller with a camera view that verifies the user and provides relevant callbacks for whether the verification was successful or not with associated voice and face confidences

myVoiceIt.encapsulatedVideoVerification(Activity, "USER_ID_HERE", "CONTENT_LANGUAGE_HERE", "my face and voice identify me", new JsonHttpResponseHandler() {...});

Identification API Calls

Voice Identification

Identify user inside group with the given groupId(begins with 'grp_') and contentLanguage('en-US','es-ES' etc.). Note: Immediately upon calling this method it records the user saying their VoicePrint phrase for 5 seconds calling the recordingFinished callback first, then it sends the recording to be identified and returns the found userId and confidence in the callback

myVoiceIt.voiceIdentification("GROUP_ID_HERE", "CONTENT_LANGUAGE_HERE", new JsonHttpResponseHandler() {...});

Video Identification

Identify user inside group with the given groupId(begins with 'grp_') and contentLanguage('en-US','es-ES' etc.). Note: File recording need to be no less than 1.2 seconds and no more than 5 seconds

myVoiceIt.videoIdentification("GROUP_ID_HERE", "CONTENT_LANGUAGE_HERE", File video, new JsonHttpResponseHandler() {...});

Author

Stephen Akers, [email protected]

License

VoiceItApi2AndroidSDK is available under the MIT license. See the LICENSE file for more info.

About

VoiceIt API 2.0 Android SDK

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages