Hye.I'm doing apps that comparing two faces between image in ID Card and live capture face image.User capture image of ID card at UploadActivity.Then,front camera at LivenessActivity will be prompted to capture face image.Then UploadActivity will automatically appear along with both images that were captured.User need to click button "verify" and it will show progress bar and upload the images to server to compare them.But,what code I have to put so that it can upload both images to the server without clicking the "verify" button?Perhaps after images appear at UploadActivity,it will directly show progress bar and upload the images to the server .This is my code for your references.Thank you in advance.
UploadActivity:
btnCaptureId.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
captureImage();
}
});
// boolean flag to identify the media type, image or video
final boolean isImage = i.getBooleanExtra("isImage",true);
previewMedia(isImage);
if (fileUri != null )
{
//go to LivenessActivity to caoture image of face
Intent intent = new Intent(this, LivenessActivity.class);
startActivityForResult(intent, 2);
}
btnverify.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// uploading the file to server
try {
new UploadFileToServer(Config.IMAGE_DOC, Config.IMAGE_FACE).execute();
} catch (JSONException e) {
e.printStackTrace();
}
}
});
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}
LivenessActivity:
@Override
public Detector.DetectionType onDetectionSuccess(DetectionFrame validFrame) {
FaceIDDataStruct dataStruct = mDetector.getFaceIDDataStruct();
if (dataStruct != null) {
face = dataStruct.images.get("image_best");
Intent returnIntent = new Intent();
returnIntent.putExtra("image_best",face);
//result go to UploadActivity
setResult(UploadActivity.PAGE_INTO_LIVENESS, returnIntent);
finish();
}
if (face == null) {
face = validFrame.getCroppedFaceImageData();
}
//do something with liveness face
return DetectionType.DONE;
}