Google User Messaging Platform (UMP) SDK는 개인 정보 보호 선택을 관리하는 데 도움이 되는 개인 정보 보호 및 메시지 도구입니다. 자세한 내용은 개인 정보 보호 및 메시지에 대한 정보를 참고하세요.
메시지 유형 만들기
Ad Manager 계정의 개인 정보 보호 및 메시지 탭에서 사용 가능한 사용자 메시지 유형 중 하나를 사용하여 사용자 메시지를 만듭니다. UMP SDK는 프로젝트에 설정된 Ad Manager 애플리케이션 ID로 생성된 개인 정보 보호 메시지를 표시하려고 시도합니다.
자세한 내용은 개인 정보 보호 및 메시지에 대한 정보를 참고하세요.
애플리케이션 ID 추가
Ad Manager 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(activity, onConsentFormDismissedListener)
사용자 동의를 받아 광고 요청하기
광고를 요청하기 전에
canRequestAds()를 사용하여 사용자로부터 동의를 얻었는지 확인합니다.
자바
consentInformation.canRequestAds();
Kotlin
consentInformation.canRequestAds()
동의를 수집하는 동안 광고를 요청할 수 있는지 확인할 수 있는 위치는 다음과 같습니다.
- UMP SDK가 현재 세션에서 동의를 수집한 후
requestConsentInfoUpdate()를 호출한 직후 UMP SDK가 이전 앱 세션에서 동의를 얻었을 수 있습니다.
동의 수집 과정에서 오류가 발생하면 광고를 요청할 수 있는지 확인하세요. UMP SDK는 이전 앱 세션의 동의 상태를 사용합니다.
중복 광고 요청 작업 방지
동의를 수집하고
requestConsentInfoUpdate()를 호출한 후
canRequestAds()를 확인하는 경우, 두 확인 모두 true를 반환할 수 있는 중복 광고 요청을 방지하는 로직을 사용해야 합니다. 예를 들어 불리언 변수를 사용합니다.
테스트
개발하면서 내 앱에서 통합을 테스트하려는 경우에는 다음 단계에 따라 테스트 기기를 프로그래매틱 방식으로 등록하세요. 앱을 출시하기 전에 이러한 테스트 기기 ID를 설정하는 코드를 반드시 삭제하세요.
requestConsentInfoUpdate()를 호출합니다.로그 출력에서 기기 ID 및 기기를 테스트 기기로 추가하는 방법을 보여주는 다음과 같은 메시지를 확인합니다.
Use new ConsentDebugSettings.Builder().addTestDeviceHashedId("33BE2250B43518CCDA7DE426D04EE231") to set this as a debug device.테스트 기기 ID를 클립보드에 복사합니다.
ConsentDebugSettings.Builder().TestDeviceHashedIds를 호출하고 테스트 기기 ID의 목록을 전달하도록 코드를 수정합니다.자바
ConsentDebugSettings debugSettings = new ConsentDebugSettings.Builder(this) .addTestDeviceHashedId("TEST-DEVICE-HASHED-ID") .build(); ConsentRequestParameters params = new ConsentRequestParameters .Builder() .setConsentDebugSettings(debugSettings) .build(); consentInformation = UserMessagingPlatform.getConsentInformation(this); // Include the ConsentRequestParameters in your consent request. consentInformation.requestConsentInfoUpdate( this, params, // ... );Kotlin
val debugSettings = ConsentDebugSettings.Builder(this) .addTestDeviceHashedId("TEST-DEVICE-HASHED-ID") .build() val params = ConsentRequestParameters .Builder() .setConsentDebugSettings(debugSettings) .build() consentInformation = UserMessagingPlatform.getConsentInformation(this) // Include the ConsentRequestParameters in your consent request. consentInformation.requestConsentInfoUpdate( this, params, // ... )
지역 강제 설정
UMP SDK는
DebugGeography를 사용하여 기기가 유럽 경제 지역(EEA), 영국, 스위스 등 다양한 지역에 있는 것처럼 앱 동작을 테스트할 수 있는 방법을 제공합니다. 디버그 설정은 테스트 기기에서만 작동합니다.
자바
ConsentDebugSettings debugSettings = new ConsentDebugSettings.Builder(this)
.setDebugGeography(ConsentDebugSettings.DebugGeography.DEBUG_GEOGRAPHY_EEA)
.addTestDeviceHashedId("TEST-DEVICE-HASHED-ID")
.build();
ConsentRequestParameters params = new ConsentRequestParameters
.Builder()
.setConsentDebugSettings(debugSettings)
.build();
consentInformation = UserMessagingPlatform.getConsentInformation(this);
// Include the ConsentRequestParameters in your consent request.
consentInformation.requestConsentInfoUpdate(
this,
params,
...
);
Kotlin
val debugSettings = ConsentDebugSettings.Builder(this)
.setDebugGeography(ConsentDebugSettings.DebugGeography.DEBUG_GEOGRAPHY_EEA)
.addTestDeviceHashedId("TEST-DEVICE-HASHED-ID")
.build()
val params = ConsentRequestParameters
.Builder()
.setConsentDebugSettings(debugSettings)
.build()
consentInformation = UserMessagingPlatform.getConsentInformation(this)
// Include the ConsentRequestParameters in your consent request.
consentInformation.requestConsentInfoUpdate(
this,
params,
...
)
동의 상태 재설정
UMP SDK로 앱을 테스트할 때 사용자의 첫 설치 경험을 시뮬레이션할 수 있도록 SDK의 상태를 재설정하면 유용합니다.
SDK에서는 이를 위한 reset() 메서드를 제공합니다.
자바
consentInformation.reset();
Kotlin
consentInformation.reset()