시작하기

컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.

Google EU 사용자 동의 정책에 따라 유럽 경제 지역 (EEA)과 영국에서 사용자에게 특정 정보를 공개해야 하며, 법적으로 필요한 경우 쿠키 또는 기타 로컬 저장소를 사용하고 개인 정보 (예: 광고 ID)를 사용하여 광고를 게재한다는 점에 대해 EEA 사용자의 동의를 받아야 합니다. 이 정책에는 EU 온라인 개인 정보 보호 지침 및 개인 정보 보호법 (GDPR)의 요구사항이 반영되어 있습니다.

게시자가 이 정책의 의무 조항을 준수할 수 있도록 Google에서는 사용자 메시지 플랫폼 (UMP) SDK를 제공합니다. UMP SDK가 최신 IAB 표준을 지원하도록 업데이트되었습니다. 이제 이러한 모든 구성을 AdMob 개인 정보 보호 및 메시지에서 편리하게 처리할 수 있습니다.

기본 요건

사용자 메시지 유형

지원되는 메시지의 전체 목록은 사용자 메시지 유형 을 참고하세요. 각 메시지 유형을 구현하는 방법에 관한 구체적인 안내는 왼쪽 탐색 메뉴를 참고하세요.

Gradle로 설치

Google 모바일 광고 SDK 버전 19.8.0 이상을 사용하는 경우 UMP SDK가 번들에 포함됩니다. 이전 버전의 모바일 광고 SDK를 사용하는 경우 다음과 같이 앱의 build.gradle에 UMP SDK를 포함하세요.

dependencies {
    // This dependency is automatically included by Google Mobile Ads SDK 19.8.0
    // or higher.
    implementation 'com.google.android.ump:user-messaging-platform:2.0.0'
}

앱의 build.gradle을 변경한 후에는 프로젝트를 Gradle 파일과 동기화해야 합니다.

그런 다음 앱 ID를 찾습니다. 를 사용하여 AndroidManifest.xml에 추가합니다.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.rewardedinterstitialexample">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <!-- Sample app ID: ca-app-pub-3940256099942544~3347511713 -->
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

메시지를 표시해야 하는지 결정

양식을 로드하기 전에 requestConsentInfoUpdate() 를 사용하여 앱을 실행할 때마다 사용자 동의 정보 업데이트를 요청해야 합니다. 이를 통해 사용자가 아직 동의를 제공하지 않았다면 동의를 제공해야 하는지 또는 동의가 만료되었는지를 판단할 수 있습니다.

필요한 경우 양식을 제시할 때 consentInformation객체에 저장된 정보를 사용합니다.

다음은 앱 시작 시 상태를 확인하는 방법의 예입니다.

자바

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.google.android.ump.ConsentForm;
import com.google.android.ump.ConsentInformation;
import com.google.android.ump.ConsentRequestParameters;
import com.google.android.ump.FormError;
import com.google.android.ump.UserMessagingPlatform;

public class MainActivity extends AppCompatActivity {
    private ConsentInformation consentInformation;
    private ConsentForm consentForm;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Set tag for under age of consent. false means users are not under
        // age.
        ConsentRequestParameters params = new ConsentRequestParameters
            .Builder()
            .setTagForUnderAgeOfConsent(false)
            .build();

        consentInformation = UserMessagingPlatform.getConsentInformation(this);
        consentInformation.requestConsentInfoUpdate(
            this,
            params,
            new ConsentInformation.OnConsentInfoUpdateSuccessListener() {
                @Override
                public void onConsentInfoUpdateSuccess() {
                    // The consent information state was updated.
                    // You are now ready to check if a form is available.
                }
            },
            new ConsentInformation.OnConsentInfoUpdateFailureListener() {
                @Override
                public void onConsentInfoUpdateFailure(FormError formError) {
                    // Handle the error.
                }
            });
    }
}

Kotlin

Coming soon.

가능한 경우 양식 로드

양식을 표시하기 전에 먼저 양식을 사용할 수 있는지 확인해야 합니다. 사용자가 제한적인 광고 추적을 사용 설정했거나 동의 연령 미만으로 태그를 지정한 경우 양식을 사용할 수 없습니다.

양식의 사용 가능 여부를 확인하려면 앞서 만든the isConsentFormAvailable() method on the ConsentInformation instance 를 사용하세요.

그런 다음 래퍼 메서드를 추가하여 양식을 로드합니다.

자바

...
       consentInformation.requestConsentInfoUpdate(
           this,
           params,
           new ConsentInformation.OnConsentInfoUpdateSuccessListener() {
               @Override
               public void onConsentInfoUpdateSuccess() {
                   // The consent information state was updated.
                   // You are now ready to check if a form is available.
                   if (consentInformation.isConsentFormAvailable()) {
                       loadForm();
                   }
               }
           },
           new ConsentInformation.OnConsentInfoUpdateFailureListener() {
               @Override
               public void onConsentInfoUpdateFailure(FormError formError) {
                   // Handle the error.

               }
            });
    }

    public void loadForm() {

    }
}

Kotlin

Coming soon.

양식을 로드하려면 the static loadConsentForm() method on the UserMessagingPlatform class를 사용하세요.

자바

public void loadForm() {
    // Loads a consent form. Must be called on the main thread.
    UserMessagingPlatform.loadConsentForm(
        this,
        new UserMessagingPlatform.OnConsentFormLoadSuccessListener() {
            @Override
            public void onConsentFormLoadSuccess(ConsentForm consentForm) {
                MainActivity.this.consentForm = consentForm;
            }
        },
        new UserMessagingPlatform.OnConsentFormLoadFailureListener() {
            @Override
            public void onConsentFormLoadFailure(FormError formError) {
                // Handle the error
            }
        }
    );
}

Kotlin

Coming soon.

필요한 경우 양식 제출

양식의 사용 가능 여부를 확인하고 로드한 후에는ConsentForm 인스턴스의show() 메서드를 사용하여 양식을 표시하세요.

앞에서consentInformation 객체를 사용하여consent status 를 확인하고loadForm() 메서드를 업데이트합니다.

자바

public void loadForm() {
    UserMessagingPlatform.loadConsentForm(
        this,
        new UserMessagingPlatform.OnConsentFormLoadSuccessListener() {
            @Override
            public void onConsentFormLoadSuccess(ConsentForm consentForm) {
                MainActivity.this.consentForm = consentForm;
                if(consentInformation.getConsentStatus() == ConsentInformation.ConsentStatus.REQUIRED) {
                    consentForm.show(
                        MainActivity.this,
                            new ConsentForm.OnConsentFormDismissedListener() {
                                @Override
                                public void onConsentFormDismissed(@Nullable FormError formError) {
                                    // Handle dismissal by reloading form.
                                    loadForm();
                                }
                            });

                }

            }
        },
        new UserMessagingPlatform.OnConsentFormLoadFailureListener() {
            @Override
            public void onConsentFormLoadFailure(FormError formError) {
                /// Handle Error.
            }
        }
   );
}

Kotlin

Coming soon.

사용자가 선택하거나 양식을 닫은 후 작업을 실행해야 하는 경우 이 로직을 양식의 완료 핸들러 또는 콜백에 배치합니다.

테스트

지역 강제 설정

UMP SDK는 the setDebugGeography method on ConsentDebugSettings.Builder를 사용하여 기기가 EEA 또는 영국에 있는 것처럼 앱 동작을 테스트할 수 있는 방법을 제공합니다.

디버그 기능을 사용하려면 앱의 디버그 설정에서 테스트 기기의 해시 ID를 제공해야 합니다. 이 값을 설정하지 않고requestConsentInfoUpdate() 를 호출하면 실행 시 앱에서 필수 ID 해시를 로깅합니다.

자바

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);
consentInformation.requestConsentInfoUpdate(this, params,
    new ConsentInformation.OnConsentInfoUpdateSuccessListener() {
        @Override
        public void onConsentInfoUpdateSuccess() {
            // The consent information state was updated.
            // You are now ready to check if a form is available.
        }
    },
    new ConsentInformation.OnConsentInfoUpdateFailureListener() {
        @Override
        public void onConsentInfoUpdateFailure(FormError formError) {
            // Handle the error.
        }
    });

Kotlin

Coming soon.

DebugGeography에는 다음 옵션 중 하나로 지리를 강제하는 옵션이 있습니다.

디버그 지리 설명
DEBUG_GEOGRAPHY_DISABLED 디버그 지역 사용 중지됨
DEBUG_GEOGRAPHY_EEA 디버그 기기의 경우 EEA에 지역이 표시됩니다.
DEBUG_GEOGRAPHY_NOT_EEA 디버그 기기의 지역이 EEA에 없는 것으로 표시됩니다.

디버그 설정은 테스트 기기에서만 작동합니다. 에뮬레이터는 기본적으로 테스트를 기본적으로 사용 설정하므로 기기 ID 목록에 추가할 필요가 없습니다.

UMP SDK로 앱을 테스트할 때 사용자의 첫 설치 환경을 시뮬레이션할 수 있도록 SDK 상태를 재설정하는 것이 도움이 될 수 있습니다. SDK는 이를 위한 reset() 메서드를 제공합니다.

자바

consentInformation.reset();

Kotlin

consentInformation.reset()

UMP SDK를 프로젝트에서 완전히 삭제하기로 결정한 경우에도 reset() 를 호출해야 합니다.