en ko

Example Code by Scenario

Each example simulates a user state via userStatus. The meaning of each state and the return rules for approval date / installID are as follows:

UserStatus

Meaning

approvalDate / installID

VERIFIED

Verified adult (18 or older)

Always "null"

SUPERVISED

Supervised minor with guardian approval

Reflects injected value

SUPERVISED_APPROVAL_DENIED

Guardian denied approval

Reflects injected value

SUPERVISED_APPROVAL_PENDING

Awaiting approval due to a significant update

Reflects injected value

UNKNOWN

Everything else (terms not agreed, not a whitelisted installer, etc.)

Always "null"

Example 1: Verified adult (18 or older)

Simulates a VERIFIED user status. Use this to verify app behavior for adult users. In this state, the approval date and installID are returned as "null".

Kotlin

val extras = Bundle().apply {
    putString("userStatus", "VERIFIED")
}

val result = contentResolver.call(uri, "getAgeSignalResult", null, extras)
// userStatus=VERIFIED, 
// mostRecentApprovalDate=null, installID=null

Java

Bundle extras = new Bundle();
extras.putString("userStatus", "VERIFIED");

Bundle result = getContentResolver().call(uri, "getAgeSignalResult", null, extras);
// userStatus=VERIFIED, 
// mostRecentApprovalDate=null, installID=null

Example 2: Supervised minor (ages 13–15)

Simulates a SUPERVISED user status. Use this to verify app behavior for a supervised minor with guardian approval. You can pass an age range along with the approval date and installID.

Kotlin

val extras = Bundle().apply {
    putString("userStatus", "SUPERVISED")
    putInt("ageLower", 13)
    putInt("ageUpper", 15)
    putString("mostRecentApprovalDate", "2026-03-23")
    putString("installID", "fake_install_id")
}

val result = contentResolver.call(uri, "getAgeSignalResult", null, extras)
// userStatus=SUPERVISED, ageLower=13, ageUpper=15,
// mostRecentApprovalDate=2026-03-23, installID=fake_install_id

Java

Bundle extras = new Bundle();
extras.putString("userStatus", "SUPERVISED");
extras.putInt("ageLower", 13);
extras.putInt("ageUpper", 15);
extras.putString("mostRecentApprovalDate", "2026-03-23");
extras.putString("installID", "fake_install_id");

Bundle result = getContentResolver().call(uri, "getAgeSignalResult", null, extras);
// userStatus=SUPERVISED, ageLower=13, ageUpper=15,
// mostRecentApprovalDate=2026-03-23, installID=fake_install_id

Example 3: Supervised minor with approval denied

Simulates a SUPERVISED_APPROVAL_DENIED user status. This is when the guardian has denied approval. Use it to verify that the access-blocked (download/purchase disabled) UI displays correctly in your app.

Kotlin

val extras = Bundle().apply {
    putString("userStatus", "SUPERVISED_APPROVAL_DENIED")
    putInt("ageLower", 13)
    putInt("ageUpper", 15)
}

val result = contentResolver.call(uri, "getAgeSignalResult", null, extras)
// userStatus=SUPERVISED_APPROVAL_DENIED

Java

Bundle extras = new Bundle();
extras.putString("userStatus", "SUPERVISED_APPROVAL_DENIED");
extras.putInt("ageLower", 13);
extras.putInt("ageUpper", 15);

Bundle result = getContentResolver().call(uri, "getAgeSignalResult", null, extras);
// userStatus=SUPERVISED_APPROVAL_DENIED

Example 4: Supervised minor awaiting significant-change approval

Simulates a SUPERVISED_APPROVAL_PENDING user status. This is when a significant update has occurred and guardian approval is pending. Use it to verify the pending-approval guidance UI.

Kotlin

val extras = Bundle().apply {
    putString("userStatus", "SUPERVISED_APPROVAL_PENDING")
    putInt("ageLower", 13)
    putInt("ageUpper", 15)
    putString("mostRecentApprovalDate", "2026-05-01")
}

val result = contentResolver.call(uri, "getAgeSignalResult", null, extras)
// userStatus=SUPERVISED_APPROVAL_PENDING, mostRecentApprovalDate=2026-05-01

Java

Bundle extras = new Bundle();
extras.putString("userStatus", "SUPERVISED_APPROVAL_PENDING");
extras.putInt("ageLower", 13);
extras.putInt("ageUpper", 15);
extras.putString("mostRecentApprovalDate", "2026-05-01");

Bundle result = getContentResolver().call(uri, "getAgeSignalResult", null, extras);
// userStatus=SUPERVISED_APPROVAL_PENDING, mostRecentApprovalDate=2026-05-01

Example 5: Unknown user

Simulates an UNKNOWN user status. This covers other states, such as store terms that are not agreed to or the installer not being allowed. As with VERIFIED, the approval date and installID are returned as "null".

Kotlin

val extras = Bundle().apply {
    putString("userStatus", "UNKNOWN")
}

val result = contentResolver.call(uri, "getAgeSignalResult", null, extras)
// userStatus=UNKNOWN, mostRecentApprovalDate=null, installID=null

Java

Bundle extras = new Bundle();
extras.putString("userStatus", "UNKNOWN");

Bundle result = getContentResolver().call(uri, "getAgeSignalResult", null, extras);
// userStatus=UNKNOWN, mostRecentApprovalDate=null, installID=null

Example 6: Handling a failure response

This example branches on success/failure by checking the response's result_code. A result_code of 0 means success and 1 means failure. Your app should always check this value first before processing the result.

Kotlin

val result = contentResolver.call(uri, "getAgeSignalResult", null, extras)

val resultCode = result?.getInt("result_code")
if (resultCode == 0) {  // VALUE_RESULT_SUCCESS
    val userStatus = result?.getString("userStatus")
    // handle success
} else {
    val message = result?.getString("result_message")
    // handle failure (see result_message)
}

Java

Bundle result = getContentResolver().call(uri, "getAgeSignalResult", null, extras);

if (result != null && result.getInt("result_code") == 0) {  // VALUE_RESULT_SUCCESS
    String userStatus = result.getString("userStatus");
    // handle success
} else {
    String message = result != null ? result.getString("result_message") : null;
    // handle failure (see result_message)
}