Android

Android 13 티라미수(Tiramisu)를 타겟팅(targetSdkVersion 32)하는 앱은 Google 광고 ID에 액세스할 수 있는 권한을 추가해야 한다. (Android 12 포함)

Android 13 티라미수(Tiramisu) 타겟팅

[안드로이드 13 티라미수(Tiramisu)가 올 하반기에 출시된다. 만약 올해 말에 안드로이드13으로 타겟팅할 수 있다.  구글플레이에서 영문 메일이 도착했다. 구글 번역기로 번역해보니 이런 내용이다

안녕하세요 Google Play 개발자입니다.

지난 7월 Google은 보안 및 개인정보 보호를 강화하기 위한 광고 정책 변경 사항을 발표했습니다. 어린이를 대상으로 하는 앱에서 사용하는 식별자에 대한 새로운 제한 사항을 추가했습니다.

사용자가 개인화 광고를 선택 해제하기 위해 광고 ID를 삭제하기로 선택한 경우 개발자는 식별자에 액세스하려고 하면 식별자 대신 0 문자열을 받게 됩니다. 이 동작은 2022년 4월 1일부터 휴대전화, 태블릿 및 Android TV로 확장됩니다.

또한 앱 대상 API 레벨을 31(Android 12)로 업데이트할 때 AD_ID 권한을 선언해야 한다고 발표했습니다. 오늘 우리는 개발자들이 쉽게 전환할 수 있도록 더 많은 시간을 줄 것임을 공유합니다. 앱이 Android 12로 시작하는 대신 Android 13을 대상으로 할 수 있는 경우 이 권한 선언이 필요합니다.

작업 항목

광고 ID를 사용하는 경우 앱이 Android 13 이상을 대상으로 할 때 AD_ID 권한을 선언해야 합니다. 권한을 선언하지 않은 앱은 문자열 0을 얻습니다. 참고: 올해 말에 Android 13을 타겟팅할 수 있습니다.
앱이 Ad ID 권한을 선언한 SDK를 사용하는 경우 매니페스트 병합을 통해 권한 선언을 획득합니다.
앱의 타겟층에 어린이가 포함된 경우 어린이나 연령을 알 수 없는 사용자의 Android 광고 ID(AAID)를 전송해서는 안 됩니다. 더 알아보기.

Hello Google Play Developer,

Last July, we announced Advertising policy changes to help bolster security and privacy. We added new restrictions on identifiers used by apps that target children.

When users choose to delete their advertising ID in order to opt out of personalization advertising, developers will receive a string of zeros instead of the identifier if they attempt to access the identifier. This behavior will extend to phones, tablets, and Android TV starting April 1, 2022.

We also announced that you need to declare an AD_ID permission when you update your app targeting API level to 31 (Android 12). Today, we are sharing that we will give developers more time to ease the transition. We will require this permission declaration when your apps are able to target Android 13 instead of starting with Android 12.

Action Items

If you use an advertising ID, you must declare the AD_ID Permission when your app targets Android 13 or above. Apps that don’t declare the permission will get a string of zeros. Note: You’ll be able to target Android 13 later this year.
If your app uses an SDK that has declared the Ad ID permission, it will acquire the permission declaration through manifest merge.
If your app’s target audience includes children, you must not transmit Android Advertising ID (AAID) from children or users of unknown age. Learn more.

광고 ID (앱에 광고를 노출하고 있는 경우)를 사용하는 경우 앱이 Android 13 이상을 대상으로 할 때 AD_ID 권한을 선언해야 한다. 그런데 이게 안드로이드 12부터 적용된다는 사실을 까먹고 있었다. 구글은 안드로이드 12 버전을 발표하면서 앞으로 “구글광고아이디(google advertising identifier)를 수집하기 위해서는 별도의 퍼미션을 추가해야 한다”라는 내용의 변경사항을 공지했었다.

기존 안드로이드 단말에서 제공하던 “광고 맞춤설정 선택 해제” 기능이 안드로이드12부터는 “광고ID 삭제” 기능으로 변경되어 제공된다. 이 기능을 통해 광고아이디를 삭제하면 광고아이디를 획득할 수 없다는 것이 가장 큰 차이이다.


광고 ID

2021년 말부터 사용자가 관심 기반 광고 또는 광고 개인화를 선택 해제하면 광고 식별자를 사용할 수 없다. 식별자 대신 0 문자열을 받게 된다.

이 업데이트는 2022년 4월 1일에 Google Play를 지원하는 Android 휴대폰, 태블릿 및 Android TV에서 실행되는 모든 앱으로 확장된다.

광고 ID는 Google Play 서비스에서 제공하는 광고용으로 사용자가 재설정할 수 있는 고유 ID이다. 사용자에게 더 나은 제어 기능을 제공하고 개발자에게 앱에서 계속 수익을 창출할 수 있는 단순하고 표준적인 시스템을 제공한다. 이를 통해 사용자는 Google Play 앱 내에서 식별자를 재설정하거나 개인 맞춤 광고(이전에는 관심 기반 광고라고 함)를 선택 해제할 수 있수있다.

2021년 말 Google Play 서비스 업데이트의 일환으로 사용자가 Android 설정에서 광고 ID를 사용하여 개인화를 선택 해제하면 광고 ID가 제거된다. 식별자에 액세스하려는 모든 시도는 식별자 대신 0 문자열을 받는다.

개발자 및 광고/분석 서비스 제공자가 규정 준수 노력을 기울이고 사용자 선택을 존중할 수 있도록 옵트아웃 기본 설정에 대한 알림을 받을 수 있다.

이 Google Play 서비스의 단계적 출시는 2021년 말부터 Android 12에서 실행되는 앱에 영향을 미치고 2022년 4월 1일부터 Google Play를 지원하는 모든 기기에서 실행되는 앱에 영향을 미치도록 확대됩니다. 분석 및 사기 방지와 같은 필수 비광고 사용 사례의 경우, 앱 세트 ID 를 사용 한다.

또한 앱이 대상을 Android 13 이상으로 업데이트할 때 다음과 같이 매니페스트 파일에서 Google Play 서비스 일반 권한을 선언해야 한다. 앱 빌드가 Android 12/API 레벨 31 이상을 대상으로 하는 경우 Google 광고 ID에 액세스할 수 있는 권한을 추가하는 것이다.

<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

대상 API 레벨이 30(Android 11) 이상으로 설정된 앱의 경우 이 권한이 필요하지 않다.

이 권한은 2022년 4월 1일부터 모든 기기에 적용됩니다. 자세한 내용은 API 설명서 를 참조.

public boolean isLimitAdTrackingEnabled ()
사용자가 광고 추적 제한을 활성화했는지 여부를 확인

반환된 값이 true인 경우 반환된 값 getId()은 
항상 00000000-0000-0000-0000-000000000000

그럼 대략 어떤 상황인지 알겠으니 작업을 시작해보자

1. AndroidManifest.xml 파일을 열고 구글광고아이디 전용 퍼미션 추가을 추가한다.  안드로이드12에서는 구글광고아이디를 얻기 위한 별도의 퍼미션이 추가 되었다. 퍼미션이 추가되지 않은 앱에서는 구글광고아이디를 획득할 수 없다.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="ddolcatmaster.smartstepcounter">
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    
	<!--앱 광고 ID 권한 권한 추가 -->
    <uses-permission android:name="com.google.android.gms.permission.AD_ID"/>    
   
     .............생략.........

구글 ADMOB 혹은 다른 광고회사의 SDK를 최신으로 유지하면 된다.

아래 작업들은 안해도 되니 참고하자!!

Google 광고 ID/광고 추적 제한 매개변수를 가져오기 위한 샘플 코드

import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.google.android.gms.ads.identifier.AdvertisingIdClient.Info;
import com.google.android.gms.common.GooglePlayServicesAvailabilityException;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import java.io.IOException;

// Do not call this function from the main thread. Otherwise, 
// an IllegalStateException will be thrown.
public void getIdAndLAT() {
    Info adInfo = null;
    try {
        adInfo = AdvertisingIdClient.getAdvertisingIdInfo(mContext);
    } catch (IOException e) {
        // Unrecoverable error connecting to Google Play services (e.g.,
        // the old version of the service doesn't support getting AdvertisingId).
    } catch (GooglePlayServicesAvailabilityException e) {
        // Encountered a recoverable error connecting to Google Play services. 
    } catch (GooglePlayServicesNotAvailableException e) {
        // Google Play services is not available entirely.
    }

    final String GAID = adInfo.getId();
    final boolean limitAdTracking = adInfo.isLimitAdTrackingEnabled();
}

2. 다음 작업으로 build.gradle(app) 앱 세트 ID 라이브러리를 추가한다.

 implementation 'com.google.android.gms:play-services-appset:16.0.2'

bulid.gradle(app)

plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 31

    defaultConfig {
        applicationId "tools.test"
        minSdkVersion 23
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    
    
    implementation 'com.google.android.gms:play-services-appset:16.0.2'
    
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

3. 앱 세트 ID를 수집하기 위해 앱에서 다음 코드를 사용한다.

Context context = getApplicationContext();
AppSetIdClient client = AppSet.getClient(context);
Task<AppSetIdInfo> task = client.getAppSetIdInfo();

task.addOnSuccessListener(new OnSuccessListener<AppSetIdInfo>() {
    @Override
    public void onSuccess(AppSetIdInfo info) {
        // Determine current scope of app set ID.
        int scope = info.getScope();

        // Read app set ID value, which uses version 4 of the
        // universally unique identifier (UUID) format.
        String id = info.getId();
    }
});

[코틀린 코드]

val client = AppSet.getClient(applicationContext) as AppSetIdClient
val task: Task<AppSetIdInfo> = client.appSetIdInfo as Task<AppSetIdInfo>

task.addOnSuccessListener({
    // Determine current scope of app set ID.
    val scope: Int = it.scope

    // Read app set ID value, which uses version 4 of the
    // universally unique identifier (UUID) format.
    val id: String = it.id
})

앱 범위

다음 조건 중 하나에서 앱 세트 ID SDK는 지정된 기기에서 호출 앱 자체에 고유한 ID를 반환한다.

  • 앱은 Google Play 스토어가 아닌 다른 설치 프로그램에 의해 설치된다.
  • Google Play 서비스는 앱의 Google Play 개발자 계정을 확인할 수 없다.
  • 앱이 Google Play 서비스가 없는 기기에 설치된다.

앱 세트 ID의 캐시된 값에 의존하지 말라.

다음 조건 중 하나에서 기기에 지정된 Google Play 스토어 설치 앱 세트에 대한 앱 세트 ID를 재설정할 수 있다.

  • 13개월 이상 동일한 ID 값을 공유하는 앱 그룹에서 앱 세트 ID API에 액세스하지 않는다.
  • 지정된 앱 세트의 마지막 앱이 기기에서 제거된다.
  • 사용자가 기기를 공장 초기화한다.

앱은 필요할 때마다 SDK를 사용하여 ID 값을 검색해야 한다.

[용어설명]

옵트인(Opt-in), 옵트아웃(Opt-out)은 개인정보 처리를 위한 동의 방식을 말하는 용어이다. 우리나라는 개인정보보호 법률에 따라 옵트인 방식을 채택하고 있다.

옵트인(Opt-in) 옵트아웃(Opt-out)
사용자에게 개인정보 수집·이용·제공에 대한 동의를 먼저 받은 후에만 개인정보를 처리할 수 있는 방식 옵트아웃(Opt-out)은 옵트인과 반대.

정보주체의 동의를 받지 않고 개인정보를 수집·이용한 후, 당사자가 거부 의사를 밝히면 개인정보 활용을 중지하는 방식

[REFERENCE]

https://support.google.com/googleplay/android-developer/answer/6048248?hl=en

https://developer.android.com/training/articles/app-set-id

https://developers.google.com/android/reference/com/google/android/gms/ads/identifier/AdvertisingIdClient.Info

https://support.singular.net/hc/en-us/articles/360037640812–UPDATED-Server-to-Server-S2S-Integration-Guide

Leave a Reply

error: Content is protected !!