Development Guide (Face Capture)
Face Capture
Starting camera
Selfie camera can be launched by invoking start method on OkaySelfieActivity with context,config and callback method as follow
config object is optional if you call from Kotlin (refer to Configuration for more info)
after the image is captured or the user cancel, the callback method will be called (refer result)
OkayCamSelfie.start(this, LICENSE_KEY, config) { success, image, exception ->
// do something with the result
}
Configuration
configuration object can be created and can be customized as follow
if no value is set for properties, default values will be implied
val config = OkaySelfieConfig.init(this)
config.frameColor = Color.YELLOW
complete list of possible configurations can be found in the following table
width
width to resize the image
null
topLabel
text
text of the top label
Please align your face within the frame
topLabel
color
color of the top label
#FFFFFF
topLabel
size
text size of the top label
24
-
frameColor
color of the selfie overlay frame
#000000
-
bottomFrameColor
color of the bottom frame
#EB6709
okaySelfieSwichBtnConfig
color
color of the switch button
#FFFFFF
okaySelfieSwichBtnConfig
show
show or hide the camera switch button
true
-
defaultCameraFacing
initial camera facing when the selfie cam is launched
CameraFacing.FRONT
Result
Result callback has 3 params as follow
success
will be true if the the image is captured successfully ,otherwise false
image
if its successful, image will contain file path of the image, otherwise will be null
exception
if its successful, exception will be null otherwise, it contains the exception that occurred during the image capturing
Face Plus Capture
Starting camera
Selfie camera can be launched by invoking start method on OkaySelfiePlus with context, license and callback method as follow
After the image is captured or the user cancel, the callback method will be called (refer result)
OkaySelfiePlus.start(this, LICENSE_KEY) { success, result, exception ->
// do something with the result
}
Result
Result callback has 3 params as follow
success
will be true if the the image is captured successfully, otherwise false
result
if it's successful, result will contain json string, otherwise will be null. { selfie: selfie_image_path, bundle: base64String }
.
exception
if it's not successful, it contains the exception that occurred during the image capturing, otherwise, exception will be null.
Last updated
Was this helpful?