Google AB Kullanıcı Rızası Politikası uyarınca Avrupa Ekonomik Alanı'ndaki (AEA) kullanıcılarınıza Birleşik Krallık ile birlikte belirli açıklamalar yapmanız ve yasal olarak gerekli olduğu durumlarda çerez veya başka yerel depolama bilgilerinin yanı sıra reklam yayınlamak için kişisel verileri (AdID gibi) kullanma konusunda izin almanız gerekir. Bu politika AB eGizlilik Yönergesi ve Genel Veri Koruma Yönetmeliği'nin (GDPR) şartlarını yansıtmaktadır.
Google, yayıncıları bu politika kapsamındaki gereksinimleri yerine getirmeleri konusunda desteklemek için Kullanıcı Mesajlaşma Platformu (UMP) SDK'sını sunmaktadır. UMP SDK'sı, en yeni IAB standartlarını destekleyecek şekilde güncellendi. Tüm bu yapılandırmalar artık gizlilik ve mesajlaşma AdMob özelliğiyle kolayca yönetilebilir.
Ön koşullar
- Başlangıç kılavuzunu tamamlayın.
- Mesajlarınızı,AdMob hesabınızın Gizlilik ve mesajlaşma sekmesi altında yapılandırın. Daha fazla bilgi için Gizlilik ve mesajlaşma hakkında,
- GDPR ile ilgili koşullar üzerinde çalışıyorsanız IAB şartları AB kullanıcı rızası alma mesajlarını nasıl etkiler? başlıklı makaleyi okuyun.
Kullanıcı mesajı türleri
Desteklenen mesajların tam listesi için Kullanıcı mesajı türleri bölümüne göz atın. Her bir mesaj türünün uygulanmasıyla ilgili talimatlar için sol gezinme çubuğuna bakın.
Gradle ile yükle
Google Mobile Ads SDK'sının 19.8.0 veya sonraki bir sürümünü kullanıyorsanız bu Gradle yükleme adımını atlayabilirsiniz. Aksi halde, UMP SDK'sını uygulamanızın build.gradle
bölümüne aşağıdaki şekilde ekleyin:
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'
}
Uygulamanızın build.gradle
bölümünde değişiklik yaptıktan sonra projenizi Gradle dosyalarıyla senkronize etmeyi unutmayın.
Manifest dosyasını güncelle
Ardından,
uygulama kimliğinizi bulun
ve AndroidManifest.xml
hesabınıza ekleyin:
<?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>
Bir mesajın gösterilmesi gerekip gerekmediğini belirleme
Bir form yüklemeden önce, requestConsentInfoUpdate()
uygulamanın ilk aşamasında kullanıcının izin bilgilerinin güncellenmesi için istekte bulunmanız gerekir.
Bu, kullanıcılarınızın henüz izin vermemiş olmaları veya izinlerinin süresinin dolduğu durumlarda izin vermeleri gerekip gerekmediğini belirleyebilir.
consentInformation
nesnede depolanan bilgileri kullanın.
Uygulama başlatıldığında durumun nasıl kontrol edileceğine dair bir örneği aşağıda bulabilirsiniz:
Java
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
package com.example.myapplication import com.google.android.ump.ConsentForm import com.google.android.ump.ConsentInformation import com.google.android.ump.ConsentInformation.OnConsentInfoUpdateFailureListener import com.google.android.ump.ConsentInformation.OnConsentInfoUpdateSuccessListener import com.google.android.ump.ConsentRequestParameters import com.google.android.ump.UserMessagingPlatform class MainActivity : AppCompatActivity() { private lateinit var consentInformation: ConsentInformation private lateinit var consentForm: ConsentForm override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // Set tag for under age of consent. false means users are not under // age. val params = ConsentRequestParameters .Builder() .setTagForUnderAgeOfConsent(false) .build() consentInformation = UserMessagingPlatform.getConsentInformation(this) consentInformation.requestConsentInfoUpdate( this, params, OnConsentInfoUpdateSuccessListener { // The consent information state was updated. // You are now ready to check if a form is available. }, OnConsentInfoUpdateFailureListener { // Handle the error. }) } }
Varsa form yükleyin
Bir form görüntülemeden önce kullanılabilir olup olmadığını belirlemeniz gerekir. Kullanılamayan formlar, kullanıcının sınırlı reklam izlemeyi etkinleştirmesinden veya reşit olma yaşından küçük olarak etiketlemesinden kaynaklanabilir.
Bir formun kullanılabilirliğini kontrol etmek için daha öncethe isConsentFormAvailable()
method on the ConsentInformation
instance oluşturduğunuz formu kullanın.
Ardından, formu yüklemek için bir sarmalayıcı yöntemi ekleyin:
Java
... 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
... consentInformation.requestConsentInfoUpdate( this, params, OnConsentInfoUpdateSuccessListener { // The consent information state was updated. // You are now ready to check if a form is available. if (consentInformation.isConsentFormAvailable) { loadForm() } }, OnConsentInfoUpdateFailureListener { // Handle the error. }) } fun loadForm() { } }
Formu yüklemek için the static loadConsentForm()
method on the UserMessagingPlatform
classkullanın.
Java
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
fun loadForm() { // Loads a consent form. Must be called on the main thread. UserMessagingPlatform.loadConsentForm( this, UserMessagingPlatform.OnConsentFormLoadSuccessListener { this.consentForm = consentForm }, UserMessagingPlatform.OnConsentFormLoadFailureListener { // Handle the error. } ) }
Gerekirse formu gönderin
Formun kullanılabilirliğini belirledikten ve yükledikten sonra, formu sunmak içinConsentForm
örneğindekishow()
yöntemini kullanın.
Önceki nesnedenconsentInformation
nesnesini kullanarakconsent status yönteminiloadForm()
güncelleyin:
Java
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; if (consentInformation.getConsentStatus() == ConsentInformation.ConsentStatus.REQUIRED) { consentForm.show( MainActivity.this, new ConsentForm.OnConsentFormDismissedListener() { @Override public void onConsentFormDismissed(@Nullable FormError formError) { if (consentInformation.getConsentStatus() == ConsentInformation.ConsentStatus.OBTAINED) { // App can start requesting ads. } // Handle dismissal by reloading form. loadForm(); } }); } } }, new UserMessagingPlatform.OnConsentFormLoadFailureListener() { @Override public void onConsentFormLoadFailure(FormError formError) { // Handle Error. } } ); }
Kotlin
fun loadForm() { // Loads a consent form. Must be called on the main thread. UserMessagingPlatform.loadConsentForm( this, UserMessagingPlatform.OnConsentFormLoadSuccessListener { this.consentForm = consentForm if (consentInformation.consentStatus == ConsentInformation.ConsentStatus.REQUIRED) { consentForm.show( this, ConsentForm.OnConsentFormDismissedListener { if (consentInformation.consentStatus == ConsentInformation.ConsentStatus.OBTAINED) { // App can start requesting ads. } // Handle dismissal by reloading form. loadForm() } ) } }, UserMessagingPlatform.OnConsentFormLoadFailureListener { // Handle the error. } ) }
Kullanıcı bir seçim yaptıktan veya formu kapattıktan sonra herhangi bir işlem yapmanız gerekiyorsa bu mantığı formunuzun tamamlanma işleyicisine veya geri çağırmasına yerleştirin.
Test
Coğrafi konumu zorunlu kılma
UMP SDK'sı, cihaz the setDebugGeography
method on ConsentDebugSettings.Builder
kullanılarak AEA veya Birleşik Krallık'taymış gibi uygulamanızın davranışını test etmek için bir yol sağlar.
Hata ayıklama işlevini kullanmak için uygulamanızın hata ayıklama ayarlarında test cihazınızın karma oluşturma işlemi uygulanmış kimliğini sağlamanız gerekir. Bu değeri ayarlamadanrequestConsentInfoUpdate()
yöntemini çağırırsanız uygulamanız, çalıştırıldığında gerekli kimlik karmasını günlüğe kaydeder.
Java
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
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) consentInformation.requestConsentInfoUpdate( this, params, OnConsentInfoUpdateSuccessListener { // The consent information state was updated. // You are now ready to check if a form is available. }, OnConsentInfoUpdateFailureListener { // Handle the error. }) }
DebugGeography
ile coğrafi konumu aşağıdaki seçeneklerden birine zorunlu kılma seçeneğiniz vardır:
Hata Ayıklama Coğrafyası | Açıklama |
---|---|
DEBUG_GEOGRAPHY_DISABLED |
Hata ayıklama coğrafyası devre dışı bırakıldı. |
DEBUG_GEOGRAPHY_EEA |
Konum, hata ayıklama cihazları için AEA'da olduğu gibi görünür. |
DEBUG_GEOGRAPHY_NOT_EEA |
Hata ayıklama cihazları için AEA'da coğrafi konum olarak görünmez. |
Hata ayıklama ayarlarının yalnızca test cihazlarında çalıştığını unutmayın. Testler varsayılan olarak etkinleştirilmiş olduğundan emülatörlerin cihaz kimliği listenize eklenmesi gerekmez.
İzin durumunu sıfırla
UMP SDK'sıyla uygulamanızı test ederken, bir kullanıcının ilk yükleme deneyimini simüle etmek için SDK durumunu sıfırlamanız yararlı olabilir.
SDK, bunu yapmanıza reset()
yönergeyi sağlar.
Java
consentInformation.reset();
Kotlin
consentInformation.reset()
Ayrıca, UMP SDK'sını projenizden tamamen kaldırmaya
karar verirseniz reset()
işlevini de çağırmanız gerekir.