Age Verification Module
First, you need to import and instantiate PRIVO auth module:
import com.privo.sdk.PrivoAgeVerification
You can instantiate the PRIVO auth module with Context:
val age Verification = PrivoAgeVerification(this)
Method 1: Check Status
ageVerification.getStatus(userIdentifier)
The method allows checking the existing Age Verification status.
Age Gate Status entry parameters:
userIdentifier - optional String field, external user identifier
Age Verification Service response:
data class AgeVerificationEvent (
val status: AgeVerificationStatus;
val profile : AgeVerificationProfile?
)
data class AgeVerificationProfile (
val userIdentifier: String?,
val firstName: String?,
val email: String?,
val birthDateYYYYMMDD: String?, // "yyyy-MM-dd" format
val phoneNumber: String? // in the full international format (E.164, e.g. "+17024181234")
)
status - enum with values: “Undefined” , “Pending” , “Confirmed” , “Declined” , “Canceled”.
profile - child profile verified by PRIVO:
userIdentifier - optional field, external user identifier
birthDateYYYYMMDD - optional field, external user birthdate in "yyyy-MM-dd" format
email - optional field, child user email address
firstName - optional field, child user first name
phoneNumber - optional field, child user phone number in the full international format (E.164, e.g.
“+17024181234”)
Please check the Age Verification Status Description here
Method 2: Run
Privo.ageVerification.run(data)
data class AgeVerificationProfile {
val userIdentifier?: String,
val birthDateYYYYMMDD?: String,
val email?: String,
val firstName?: String,
val phoneNumber?: string; // in the full international format (E.164, e.g. “+17024181234”)
}
The method runs the Age Verification check and returns the following statuses, depending on the user’s age and set by a
partner configuration parameters: “Undefined” , “Pending” , “Confirmed” , “Declined” , “Canceled”.
AgeVerificationProfile entry (profile) parameters:
userIdentifier - optional field, external user identifier
birthDateYYYYMMDD - optional field, external user birthdate in "yyyy-MM-dd" format
email - optional field, child user email address
firstName - optional field, child user first name
phoneNumber - optional field, child user phone number in the full international format (E.164, e.g.
“+17024181234”)
Response:
data class AgeVerificationEvent (
val status: AgeVerificationStatus;
val profile : AgeVerificationProfile?
)
data class AgeVerificationProfile (
val userIdentifier: String?,
val firstName: String?,
val email: String?,
val birthDateYYYYMMDD: String?, // "yyyy-MM-dd" format
val phoneNumber: String? // in the full international format (E.164, e.g. "+17024181234")
)
status - enum, “Undefined” , “Pending” , “Confirmed” , “Declined” , “Canceled”.
profile - child profile verified by PRIVO:
userIdentifier - optional field, external user identifier
birthDateYYYYMMDD - optional field, external user birthdate in "yyyy-MM-dd" format
email - optional field, child user email address
firstName - optional field, child user first name
phoneNumber - optional field, child user phone number in the full international format (E.164, e.g.
“+17024181234”)
Please check the Age Verification Status Description here
Age Gate SDK example:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ageVerification = PrivoAgeVerification(this)
}
// ...
ageVerification.getStatus(userIdentifier) {
processNewStatus(it?.status)
}
// ...
val data = AgeVerificationProfile(
userIdentifier,
birthDateYYYYMMDD,
email,
firstName,
phoneNumber
)
ageVerification.run(data) {
processNewStatus(it?.status)
}