Agent Mode

There are two major components on the sdk which are useful to agent who do multiple enrols, the first is the back camera and the second the ability to have multiple enrols and submit them all later.

Back Camera

There are often situations such as agent based applications where it makes more sense to use the back-facing camera to take a SmartSelfie than it does to use the front-facing camera.

To Register or Authenticate users with back-facing cameras, set the cameraType in your SelfieCaptureConfig as shown below:

private SelfieCaptureConfig getCaptureConfig()
{ return new SelfieCaptureConfig.Builder(this)
.setCameraType(SelfieCaptureConfig.BACK_CAMERA)//Back camera
.setPreview(mPreview)
.setManualSelfieCapture(true)
.setFlashScreenOnShutter(true)
.build();
}

One important factor to note is that you’ll likely want to couple this with manual selfie capture (i.e. a button) rather than triggering capture based on a user's smile, as the agent will be the one looking at the camera preview and thus will trigger when the selfie is to be captured.

If you choose to do this, make sure to enable a visible capture button:

@Override public void onFaceStateChange(FaceState faceState) {
switch (faceState) {
case DO_SMILE:
if (timeElapsed>timeMinimum){
btnUserCapture.setVisibility(View.VISIBLE);
}
}
}
@Override public void onCaptureButtonClicked(View view) {
smartSelfieManager.takePicture();
}

Offline Mode

Often in the market you may find use cases where you need to perform Actions but the user doesn't have an Internet connection. The Smile ID SDK enables users to store jobs captured offline on the phone for upload at a later stage when an Internet connection is recovered. This functionality is flexible and can be implemented numerous ways. This guide discusses the primary examples of how to implement "offline/store and forward mode"

Things to know upfront.

1. Jobs are stored locally on device storage until upload.

2. When you capture any job with the Smile Identity SDK, we store the images captured for the job and job information locally in a folder on the phone. These files are only deleted upon successful upload.

This means, one can capture as many jobs as they want while offline and our SDK simply stores them locally for upload at a later time.

3. Jobs are identified and stored locally on the user's phone based on a tag

When capturing a job, you have to provide a tag to identify the job. The tag can be any unique string a is defined as follows:

smartSelfieManager.captureSelfie("EXAMPLE_TAG_1");

The images are information stored locally in a folder in the root called

sid.jobs.sL.

A new folder will be generated for each job based on their tag in the sid.jobs.sL as shown below:

sid.jobs.sL -D10_C101_EXAMPLE_TAG_3

This method will synchronously upload any outstanding jobs.

How can you handle the changes in Internet connection?

The good news is that you never have to worry about a job failing because of connection errors. We will store all jobs on the phone until we have successfully received the upload. But, there are still numerous use cases that require you to cater for a change in connectivity.

One simple method to do this is called

SIDNetworkingUtils.haveNetworkConnection(this)

With this method, you can easily check whether or not there is an internet connection.

if (SIDNetworkingUtils.haveNetworkConnection(this)) {
mSINetworkrequest.submit(createConfig(tag));
}

That method is great for ensuring you are never unnecessarily performing an action that requires Internet connection when the user has no connectivity. This handles cases when the user is performing an Action. But there are also times where you want to perform certain functionality in the background when a change in connectivity occurs

For example, if an Internet connection is regained, you might want to automatically upload jobs that are still outstanding. You can implement our

InternetStateBroadCastReceiver.OnConnectionReceivedListener in your activity which will update you of changes in Internet connectivity.

The snippet of code below will submit all outstanding jobs once an internet connection is recovered.

@Override public void onInternetStateChanged(boolean recovered) { if (recovered) {
mSINetworkrequest.submitAll(createConfig(tag)); }
}