VoiceIt API 2.0 Android SDK
Switch branches/tags
Nothing to show
Clone or download
Stephen
Latest commit 3a17af3 Dec 11, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea Update version Dec 10, 2018
Graphics update README Oct 23, 2018
app
gradle/wrapper Added option to show still frame of preview Nov 13, 2018
voiceit2 Added camera source error handling Dec 11, 2018
.gitignore Added platformId Jul 16, 2018
.travis.yml
LICENSE Initial commit Feb 5, 2018
README.md Update README.md Nov 28, 2018
build.gradle
email.sh add autoemail functionality Nov 19, 2018
gradle.properties
gradlew
gradlew.bat Initial commit Feb 5, 2018
settings.gradle Initial commit Feb 5, 2018
update.sh fixed update.sh Oct 11, 2018

README.md

VoiceIt 2 Android SDK travisstatus

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 view your API Key and Token in the settings page(as shown below). You can also review the HTTP Documentation at api.voiceit.io.

API Key and Token

Requirements

minSdkVersion: 17

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 your API Credentials or user token.

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 {

    private VoiceItAPI2 myVoiceIt;

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

        // If using user tokens, replace API_KEY below with the user token,
        // and leave the second argument as an empty string
        myVoiceIt = new VoiceItAPI2("API_KEY","API_TOK");
    }
}

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 with ellipses 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());
        }
    }
});

Liveness Detection

For our Encapsulated Face and Video Verification methods, liveness detection can be enabled with a passed in boolean parameter. This enables a a pre-check(prompting to the user to turn their head or smile) before the verification API call to decrease the chance the user is able to spoof with a photo of someone else.

Encapsulated Methods

Methods that take care of all the logic of enrollment and verification, and the UI in new Android Activities. Immediately upon calling a method it displays a enrollment/verification view controller that enrolls/verifies the user and provides relevant callbacks for whether the API calls were successful or not with associated biometric confidence. Note: If less than the required enrollments exist for a user, enrollment methods delete them and re-enroll.

Encapsulated Voice Enrollment

Create three voice enrollments user with given userId(begins with 'usr_'), contentLanguage('en-US','es-ES' etc.), and a given phrase such as "Never forget tomorrow is a new day".

myVoiceIt.encapsulatedVoiceEnrollment(Activity, "USER_ID_HERE", "CONTENT_LANGUAGE_HERE", "PHRASE_HERE", new JsonHttpResponseHandler() {...});

Encapsulated Voice Verification

Verify user with given userId(begins with 'usr_'), contentLanguage('en-US','es-ES' etc.), and a given phrase such as "Never forget tomorrow is a new day".

myVoiceIt.encapsulatedVoiceVerification(Activity, "USER_ID_HERE", "CONTENT_LANGUAGE_HERE", "PHRASE_HERE", new JsonHttpResponseHandler() {...});

Encapsulated Voice Identification

Identify user from given groupId(begins with 'grp_'), contentLanguage('en-US','es-ES' etc.), and a given phrase such as "Never forget tomorrow is a new day".

myVoiceIt.encapsulatedVoiceIdentification(Activity, "GROUP_ID_HERE", "CONTENT_LANGUAGE_HERE", "PHRASE_HERE", new JsonHttpResponseHandler() {...});

Encapsulated Face Enrollment

Create three face enrollments for user with given userId(begins with 'usr_').

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

Encapsulated Face Verification

Verify user with given userId(begins with 'usr_'), and a boolean to enable liveness detection.

myVoiceIt.encapsulatedFaceVerification(Activity, "USER_ID_HERE", true, new JsonHttpResponseHandler() {...});

Encapsulated Face Identification

Identify user from given groupId(begins with 'grp_'), and a boolean to enable liveness detection.

myVoiceIt.encapsulatedFaceIdentification(Activity, "GROUP_ID_HERE", true, 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".

myVoiceIt.encapsulatedVideoEnrollment(Activity, "USER_ID_HERE", "CONTENT_LANGUAGE_HERE", "PHRASE_HERE", new JsonHttpResponseHandler() {...});

Encapsulated Video Verification

Verify user with given userId(begins with 'usr_'), contentLanguage('en-US','es-ES' etc.), a given phrase such as "my face and voice identify me", and a boolean to enable liveness detection.

myVoiceIt.encapsulatedVideoVerification(Activity, "USER_ID_HERE", "CONTENT_LANGUAGE_HERE", "PHRASE_HERE", true, new JsonHttpResponseHandler() {...});

Encapsulated Video Identification

Identify user from given groupId(begins with 'grp_'), contentLanguage('en-US','es-ES' etc.), a given phrase such as "my face and voice identify me", and a boolean to enable liveness detection.

myVoiceIt.encapsulatedVideoIdentification(Activity, "GROUP_ID_HERE", "CONTENT_LANGUAGE_HERE", "PHRASE_HERE", true, new JsonHttpResponseHandler() {...});

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.checkUserExists("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 Voice Enrollments

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

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

Get All Face Enrollments

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

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

Get All Video Enrollments

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

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

Delete All Enrollments

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

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

Delete Voice Enrollment

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

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

Delete Face Enrollment

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

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

Delete Video Enrollment

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

myVoiceIt.deleteVideoEnrollment( "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: File recording need to be no less than 1.2 seconds and no more than 5 seconds. If the recording argument is left out, the method immediately records the user saying their VoicePrint phrase for 5 seconds.

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

Create Voice Enrollment by URL

Create voice 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.createVoiceEnrollmentByUrl("USER_ID_HERE", "CONTENT_LANGUAGE_HERE", "PHRASE_HERE", "URL_TO_AUDIO_FILE_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", "PHRASE_HERE", File video, new JsonHttpResponseHandler() {...});

Create Video Enrollment by URL

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.createVideoEnrollmentByUrl("USER_ID_HERE", "CONTENT_LANGUAGE_HERE", "PHRASE_HERE", "URL_TO_VIDEO_FILE_HERE", new JsonHttpResponseHandler() {...});

Create Face Enrollment

Create face enrollment for user with given userId(begins with 'usr_') Note: It is recommended that you send a 2.0 second mp4 video

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

Create Face Enrollment by URL

Create face enrollment for user with given userId(begins with 'usr_') Note: It is recommended that you send a 2.0 second mp4 video

myVoiceIt.createFaceEnrollmentByUrl("USER_ID_HERE", "URL_TO_VIDEO_FILE_HERE", 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.

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

Voice Verification by URL

Verify user with the 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.voiceVerificationByUrl("USER_ID_HERE", "CONTENT_LANGUAGE_HERE", "PHRASE_HERE", "URL_TO_AUDIO_FILE_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, then sends it to be added as an enrollment and returns the result in the callback

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

Video Verification by URL

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

myVoiceIt.videoVerificationByUrl("USER_ID_HERE", "CONTENT_LANGUAGE_HERE", "PHRASE_HERE", "URL_TO_VIDEO_FILE_HERE", new JsonHttpResponseHandler() {...});

Face Verification

Verify user's face with given userId(begins with 'usr_'). Note: Provide an about 2.0 seconds long video(mp4 codec is recommended) of the user's face

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

Face Verification by URL

Verify user's face with given userId(begins with 'usr_'). Note: Provide an about 2.0 seconds long video(mp4 codec is recommended) of the user's face

myVoiceIt.faceVerificationByUrl("USER_ID_HERE", "URL_TO_VIDEO_FILE_HERE", 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.

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

Voice Identification by URL

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

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

Face Identification

Identify user inside group with the given groupId(begins with 'grp_'). Note: File recording need to be no less than 1.2 seconds and no more than 5 seconds

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

Face Identification by URL

Identify user inside group with the given groupId(begins with 'grp_'). Note: File recording need to be no less than 1.2 seconds and no more than 5 seconds

myVoiceIt.faceIdentificationByUrl("GROUP_ID_HERE", "URL_TO_VIDEO_FILE_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", "PHRASE_HERE", File video, new JsonHttpResponseHandler() {...});

Video Identification by URL

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.videoIdentificationByUrl("GROUP_ID_HERE", "CONTENT_LANGUAGE_HERE", "PHRASE_HERE", "URL_TO_VIDEO_FILE_HERE", new JsonHttpResponseHandler() {...});

Author

Stephen Akers, stephen@voiceit.io

License

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