SIDMetada is an object used to send two different kinds of metadata the first one being the User id information and partner parameters which can be associated with jobs to instantiate the metadata object you do the below
//InstantiationSIDMetadata metadata = new SIDMetadata();//To get the user id informationSIDUserIdInfo userIdInfo = metadata.getSidUserIdInfo();//To get the partner parametersPartnerParams params = metadata.getPartnerParams();
Below are the use case for the metadata and association with job
ID card data can be set using SIDUserIdInfo object
. It uses a declarative mechanism. Setting ID card infos, this should be set prior to start ID card capture.
Step 1: Create the use SIDUserIdInfo object which is a child object of SIDMetadata
SIDMetadata metadata = new SIDMetadata();SIDUserIdInfo userIdInfo = metadata.getSidUserIdInfo();
Step 2 : Once the SIDUserIdInfo is available there are a couple of methods which can be called to set the user info as required
//For setting first nameuserIdInfo.setFirstName("firstName")//For setting last nameuserIdInfo.setLastName("lastName")//For setting middle nameuserIdInfo.setMiddleName("middleName")//For setting countryuserIdInfo.setCountry("country")//For setting id typeuserIdInfo.setIdType("idType")//For setting id numberuserIdInfo.setIdNumber("idNumber")//For setting emailuserIdInfo.setEmail("email")
Step 3: For any optional or extra information that may be associated with the userIdInfo there is a method which can be used to add or remove additional information
//add additional informationuserIdInfo.additionalValue("key","value");//remove additional informationuserIdInfo.removeAdditionalValue("name")
Step 4: Set the metadata object to the job's config
//Instantiate the SIDConfig builder and set the metadataSIDConfig.Builder sidConfig = new SIDConfig.Builder(this)......setSIDMetadata(metadata)......build(tag);
Step 5: Submit the job
//Instantiate SIDNetworkRequest object to sendSIDNetworkRequest mSINetworkrequest = new SIDNetworkRequest(this);.........//submit the jobmSINetworkrequest.submit(sidConfig);
Partner Parameters allow you to add any additional information that you would like associated with the job. This information will come back as a JSON object in results send from the Smile Identity server. A common use case for this is to add your own unique ID to track the job as it relates to a user/instance in your own system. All fields in the partner_params must be Strings.
To modify or add additional data to the PartnerParams JSON (see Partner Parameters)
First you need to get an instance of PartnerParams from the SIDMetadata class.
SIDMetadata metadata = new SIDMetadata();PartnerParams params = metadata.getPartnerParams();
2) You can call these methods to add predefined partner params data.
//set the user idparams.setUserId("your user if");//set the enrolled job idparams.setEnrolledJobId("job id");//set the job typeparams.setJobType(int jobType);