Google 사용자 메시지 플랫폼 (UMP) SDK는 개인 정보 보호에 대한 선택사항을 관리하는 데 도움이 되는 개인 정보 보호 및 메시지 도구입니다. 자세한 내용은 개인 정보 보호 및 메시지에 대한 정보를 참고하세요.
기본 요건
- Android API 수준 21 이상
메시지 유형 만들기
AdMob 계정의 개인 정보 보호 및 메시지 탭에서 사용 가능한 사용자 메시지 유형 중 하나를 사용하여 사용자 메시지를 만듭니다. UMP SDK는 프로젝트에 설정된 AdMob 애플리케이션 ID에서 생성된 개인 정보 보호 메시지를 표시하려고 시도합니다.
자세한 내용은 개인 정보 보호 및 메시지에 대한 정보를 참고하세요.Gradle로 설치
모듈의 앱 수준 Gradle 파일(일반적으로 app/build.gradle)에 Google 사용자 메시지 플랫폼 SDK 종속 항목을 추가합니다.
dependencies {
implementation("com.google.android.ump:user-messaging-platform:4.0.0")
}
앱의 build.gradle을 변경한 후에는 프로젝트를 Gradle 파일과 동기화해야 합니다.
애플리케이션 ID 추가
AdMob UI에서 애플리케이션 ID를 확인할 수 있습니다.
다음 코드 스니펫을 사용하여 AndroidManifest.xml에 ID를 추가합니다.
<manifest>
<application>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
</application>
</manifest>
사용자의 동의 정보 가져오기
사용자의 동의 정보를 가져오려면 다음 단계를 따르세요.
ConsentInformation의 인스턴스를 선언합니다.
자바
private final ConsentInformation consentInformation;
Kotlin
private lateinit var consentInformation: ConsentInformation
ConsentInformation 인스턴스를 초기화합니다.
자바
consentInformation = UserMessagingPlatform.getConsentInformation(context);
Kotlin
consentInformation = UserMessagingPlatform.getConsentInformation(context)
앱을 실행할 때마다
requestConsentInfoUpdate()를 사용하여 사용자 동의 정보 업데이트를 요청해야 합니다. 이 요청은 다음을 확인합니다.
- 동의가 필요한지 여부 예를 들어 처음으로 동의가 필요하거나 이전 동의 결정이 만료된 경우입니다.
- 개인 정보 보호 옵션 진입점이 필요한지 여부 일부 개인 정보 보호 메시지에서는 앱이 사용자가 언제든지 개인 정보 보호 옵션을 수정할 수 있도록 허용해야 합니다.
자바
// Requesting an update to consent information should be called on every app launch.
consentInformation.requestConsentInfoUpdate(
activity,
params,
() -> // Called when consent information is successfully updated.
requestConsentError -> // Called when there's an error updating consent information.
Kotlin
// Requesting an update to consent information should be called on every app launch.
consentInformation.requestConsentInfoUpdate(
activity,
params,
{
// Called when consent information is successfully updated.
},
{ requestConsentError ->
// Called when there's an error updating consent information.
},
)
개인 정보 보호 메시지 양식을 로드하고 표시
최신 동의 상태를 수신한 후
loadAndShowConsentFormIfRequired()를 호출하여 사용자 동의를 수집하는 데 필요한 양식을 로드합니다. 로드가 완료되면 양식이 즉시 표시됩니다.
자바
UserMessagingPlatform.loadAndShowConsentFormIfRequired(
activity,
formError -> {
// Consent gathering process is complete.
});
Kotlin
UserMessagingPlatform.loadAndShowConsentFormIfRequired(activity) { formError ->
// Consent gathering process is complete.
}
개인 정보 보호 옵션
일부 개인 정보 보호 메시지 양식은 게시자가 렌더링한 개인 정보 보호 옵션 진입점에서 표시되므로 사용자가 언제든지 개인 정보 보호 옵션을 관리할 수 있습니다. 개인 정보 보호 옵션 진입점에서 사용자에게 표시되는 메시지에 대해 자세히 알아보려면 사용 가능한 사용자 메시지 유형을 참고하세요.
개인 정보 보호 옵션 진입점이 필요한지 확인
requestConsentInfoUpdate()를 호출한 후
getPrivacyOptionsRequirementStatus()를 확인하여 앱에 개인 정보 보호 옵션 진입점이 필요한지 확인합니다. 진입점이 필요한 경우 개인 정보 보호 옵션 양식을 표시하는 표시되고 상호작용 가능한 UI 요소를 앱에 추가합니다. 개인 정보 보호 진입점이 필요하지 않은 경우 UI 요소가 표시되지 않고 상호작용할 수 없도록 구성하세요.
자바
/** Helper variable to determine if the privacy options form is required. */
public boolean isPrivacyOptionsRequired() {
return consentInformation.getPrivacyOptionsRequirementStatus()
== PrivacyOptionsRequirementStatus.REQUIRED;
}
Kotlin
/** Helper variable to determine if the privacy options form is required. */
val isPrivacyOptionsRequired: Boolean
get() =
consentInformation.privacyOptionsRequirementStatus ==
ConsentInformation.PrivacyOptionsRequirementStatus.REQUIRED
개인 정보 보호 옵션 요구사항 상태의 전체 목록은
ConsentInformation.PrivacyOptionsRequirementStatus를 참고하세요.
개인 정보 보호 옵션 양식 표시
사용자가 요소와 상호작용하면 개인 정보 보호 옵션 양식을 표시합니다.
자바
UserMessagingPlatform.showPrivacyOptionsForm(activity, onConsentFormDismissedListener);
Kotlin
UserMessagingPlatform.showPrivacyOptionsForm