Skip to content

Instantly share code, notes, and snippets.

@jaydeepw
Created February 27, 2020 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaydeepw/a4600e8285681e27e87ab1858f6f9d91 to your computer and use it in GitHub Desktop.
Save jaydeepw/a4600e8285681e27e87ab1858f6f9d91 to your computer and use it in GitHub Desktop.
// Step 1: Integrate the api_sdk as well in app/build.gradle
compile ('com.trustvision:tv_api_sdk:1.0.17@aar') {
transitive = true
}
// Step 2:
// If the image is in base64, convert it to byte array
// use something like below
// byte[] decodedString = Base64.decode(base64String, Base64.DEFAULT);
// Step 3: Use its method to upload the image.
byte[] imageData = new byte[30]; // data of your image from your backend
String imageName = "name_of_your_image"; // this can be null
TVApi.getInstance().uploadImage(imageData, imageName, null, new TVCallback<TVUploadImageResponse>() {
@Override
public void onSuccess(TVUploadImageResponse tvUploadImageResponse) {
if (tvUploadImageResponse != null) {
String imageId = tvUploadImageResponse.getImageId();
// send this imageId to the faceCompare TS SDK method and the other image
// that you capured
}
}
@Override
public void onError(List<TVApiError> list) {
// handle error
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment