Development (Document Capture)
This page contains the information of Usage, Configuration, Result of OkayCam for Android, iOS and React-native in Document Capture
Last updated
This page contains the information of Usage, Configuration, Result of OkayCam for Android, iOS and React-native in Document Capture
Last updated
For Android, the Camera can be launched by invoking the start method on OkayCameraActivity with context, license key, config and callback method as follow:
A License Key is required to start the SDK.
The configuration object is optional if is calling from Kotlin.
The configuration object can be created and can be customized as the code below:
This is a complete list of possible configurations that has been provided to the user to make any custom configuration:
If there is no value is set for properties, default values will be implied.
After the image is capture or cancelled by the user, the callback method will be called.
Result callback has 3 parameters as follow:
The OkayCam contains two different user interface, one will be with flash and another one without flash. The only difference between these two user interfaces is one contains a timer (with flash) and the other one does not contain a timer (without flash) on the screen.
Example 1 (without flash):
Example 2 (with flash):
Example 3 (with frame content):
-
Property
Description
Default Value
-
crop
crop the frame area
false
-
width
width to resize the image
null
-
torchBtnEnabled
to show torch button. If set to true, it will only be shown if onFlash from captureConfig is set to false.
false
-
imageQuality
quality of the image
1.0f (range from 0 to 1.0)
topLabel
text
text of the top label
" "(empty string)
topLabel
color
color of the top label
#FFFFFF
topLabel
size
text size of the top label
24
bottomLabel
text
text of the bottom label
" "(empty string)
bottomLabel
color
color of the bottom label
#FFFFFF
bottomLabel
size
text size of the bottom label
24
frame
size
size of the camera overlay frame
null
frame
color
color of the camera overlay frame
#FFFFFF
frame
content
content of the camera overlay frame (able to display vector drawable within the frame for guidance)
null (drawable id / file path)
-
showOverlay
transparent black background for camera overlay
true
timer
backgroundColor
background of the count down timer
#662196F3
timer
textColor
text color of the count down timer
#FFFFFF
-
captureBtnColor
color of the capture button
#EB144C
confirmBtnConfig
backgroundColor
background color of the confirm button
#EB144C
confirmBtnConfig
contentColor
content color of the confirm button
#FFFFFF
retakeBtnConfig
backgroundColor
background color of the retake button
#EB144C
retakeBtnConfig
contentColor
content color of the retake button
#FFFFFF
captureConfig
first
config for the first capture
delay: countdown before capture
onFlash: enable/disable flash
outputPath: desired output image path
delay:0s, onFlash:false, outputPath: null
captureConfig
second
config for the second capture
delay: countdown before capture
onFlash: enable/disable flash
outputPath: desired output image path
delay:5s, onFlash:true, outputPath: null
Result
Description
Success
It will be true if the image is captured successfully, else it will return false.
Images
If it is successful, images will contain the file path of 2 images in a list of format, else it will return null.
Exception
If it is successful, the exception will be null, else it will contain the exception that occurred during the image capturing.
Property
Type
Default Value
topLabel
OkayCamLabelConfig
OkayCamLabelConfig(text: "Tap to focus", color: UIColor.white, size: CGFloat(24))
bottomLabel
OkayCamLabelConfig
OkayCamLabelConfig(text: "Please align ID card within frame", color: UIColor.white, size: CGFloat(24))
frame
OkayCamFrameConfig
OkayCamFrameConfig(size: CGSize(width: 210, height: 150), color: .orange, content: URL(fileURLWithPath: Bundle.main.path(forResource: "card", ofType: "svg")!))
showOverlay
Bool
true
timer
OkayCamTimerConfig
OkayCamTimerConfig(backgroundColor: UIColor.black, textColor: UIColor.white)
captureBtnColor
UIColor
UIColor(red: 0.92, green: 0.08, blue: 0.30, alpha: 1.0)
confirmBtnConfig
OkayCamBtnConfig
OkayCamBtnConfig(
backgroundColor: UIColor(red: 0.92, green: 0.08, blue: 0.30, alpha: 1.0),
contentColor: UIColor.white
)
retakeBtnConfig
OkayCamBtnConfig
OkayCamBtnConfig(
backgroundColor: UIColor(red: 0.92, green: 0.08, blue: 0.30, alpha: 1.0),
contentColor: UIColor.white
)
torchBtnEnabled
Bool
false
captureConfigPair
CaptureConfigPair
CaptureConfigPair(firstPhoto: OkayCamCaptureConfig(timeOut: 0, onFlash: false, outputPath: nil), secondPhoto: nil)
crop
Bool
false
width
Int
nil
imageQuality
CGFloat
1.0 (range from 0 to 1.0)
Result
Description
filepaths
If it is successful, images will contain the file path of 2 images in a list of format, else it will return nil.
error
If it is successful, the error will be nil, else it will contain the error that occurred during the image capturing.
-
Property
Description
Default Value
-
crop
crop the frame area
false
-
width
width to resize the image
-1
-
torchBtnEnabled
to show torch button. If set to true, it will only be shown if onFlash from captureConfig is set to false.
false
-
imageQuality
quality of image
1.0 (range from 0 to 1.0)
frame
size
size of the frame (width and height)
90% of width and height is scaled proportionally to card size
frame
color
color of the frame
#FFFFFF
frame
content
content of the frame (able to display svg file within the frame for guidance)
null
-
showOverlay
transparent black overlay
true
topLabel
text
text of the top label
"" (empty string)
topLabel
color
color of the top label
#FFFFFF
topLabel
size
text size of the top label
20
bottomLabel
text
text of the bottom label
"" (empty string)
bottomLabel
color
color of the bottom label
#FFFFFF
bottomLabel
size
text size of the bottom label
20
timer
backgroundColor
background of the countdown timer
#FFA500
timer
textColor
text color of the countdown timer
#FFFFFF
-
captureBtnColor
color of the capture button
#FFFFFF
confirmBtnConfig
backgroundColor
background of the confirm button
#EB144C
confirmBtnConfig
contentColor
content color of the confirm button
#FFFFFF
retakeBtnConfig
backgroundColor
background of the retake button
#EB144C
retakeBtnConfig
contentColor
content color of the retake button
#FFFFFF
firstPhotoConfig
config for the first capture
delay:0s,onFlash:false,
outputPath: null
secondPhotoConfig
config for the second capture
null
Result
Description
fullDocumentImage
Result of firstPhotoConfig
fullDocumentImage2
Result of secondPhotoConfig. Will only return if secondPhotoConfig is configured