2) AppsFlyer도 이번에 버전업(6.13.0) 해서 보니, GDPR 관련 설정 옵션(AppsFlyerConsent 클래스가 생김)이 생겼다.
아래 예시와 같이 GDPR 정보 셋팅 후, AppsFlyer를 Initialize 하라고 한다.
// If the user is subject to GDPR - collect the consent data
// or retrieve it from the storage
...
// Set the consent data to the SDK:
AppsFlyerConsent consent = AppsFlyerConsent.ForGDPRUser(true, true);
AppsFlyer.setConsentData(consent);
AppsFlyer.startSDK();
GDPR 테스트 관련 소스가 들어있는데, Test Device Hashed Id를 넣으라고 돼있고, 실행해보면 Logcat에 뜬다고 돼 있는데 안떠서 찾아보니 아래와 같은 내용이 있다.
(난 현재 테스트 폰이 API 30이 안돼서 Test Device Hashed Id는 안넣어도 되는 것 같다.)
I also struggled with the same problem. The reason NOT_REQUIRED is always returned is that the test device ID has not been registered. DebugGeography does not apply to non-test devices. In my case, even if it is a basic Android emulator, I had to register the test device ID to resolve this issue. Your emulator's device ID is displayed in logcat as follows when ConsentInformation.requestConsentInfoUpdate is called.
Use new ConsentDebugSettings.Builder().addTestDeviceHashedId("xxxxxxxxx") to set this as a debug device.
EDIT:I did more tests. It requires a test device ID since Android API 30. Until API 29, it is not necessary to specify the test device ID. I'm not sure if this is only for my development environment.
using GoogleMobileAds.Ump.Api;
#region UMP(User Messaging Platform)
/// <summary>
/// Privacy(GDPR) 요청
/// </summary>
public void Request_Privacy_GDPR()
{
RequestConsentInfo();
}
///Summary
///Request Consent Information
///Warning: Ads can be preloaded by the Google Mobile Ads SDK or mediation partner SDKs
///upon calling MobileAds.Initialize(). If you need to obtain consent from users in the European Economic Area (EEA), set any request-specific flags, such as tagForChildDirectedTreatment or tag_for_under_age_of_consent, or otherwise take action before loading ads.
///Ensure you do this before initializing the Google Mobile Ads SDK.
///Summary
void RequestConsentInfo()
{
Debug.Log("[UMP] RequestConsentInfo()");
// Set tag for under age of consent.
// Here false means users are not under age of consent.
ConsentRequestParameters request = new ConsentRequestParameters
{
TagForUnderAgeOfConsent = false,
};
// Check the current consent information status.
ConsentInformation.Update(request, OnConsentInfoUpdated);
}
void OnConsentInfoUpdated(FormError consentError)
{
if (consentError != null)
{
// Handle the error.
UnityEngine.Debug.LogErrorFormat("[UMP][OnConsentInfoUpdated] {0}", consentError);
// UMP 동의 Error 시에도 초기화 진행[blueasa / 2024-03-15]
InitializeGoogleMobileAds();
return;
}
// If the error is null, the consent information state was updated.
// You are now ready to check if a form is available.
ConsentForm.LoadAndShowConsentFormIfRequired((FormError formError) =>
{
if (formError != null)
{
// Consent gathering failed.
UnityEngine.Debug.LogErrorFormat("[UMP][LoadAndShowConsentFormIfRequired] {0}", consentError);
// UMP 동의 Error 시에도 초기화 진행[blueasa / 2024-03-15]
InitializeGoogleMobileAds();
return;
}
// Consent has been gathered.
if (ConsentInformation.CanRequestAds())
{
// UMP 동의 이후 GoogleMobileAds 초기화[blueasa / 2023-12-14]
// GDPR 동의 했거나, EU가 아니어도 호출되기 때문에 여기서 초기화 함.
InitGoogleMobileAds();
}
});
}
/// <summary>
/// Privacy(GDPR) Button 활성화 여부 체크
/// (설정 창에 버튼 추가함)
/// </summary>
public bool CheckActivePrivacyButton()
{
bool bActive = false;
// EU인지 여부에 따라 버튼 활성화 체크 필요
#region ConsentInformation.PrivacyOptionsRequirementStatus
bActive = IsPrivacyOptionsRequirement();
#endregion
#region ConsentInformation.ConsentStatus
//bActive = IsConsentForGDPR();
#endregion
return bActive;
}
public bool IsPrivacyOptionsRequirement()
{
// [PrivacyOptionsRequirementStatus enum 참조]
// https://developers.google.com/admob/unity/reference/namespace/google-mobile-ads/ump/api#namespace_google_mobile_ads_1_1_ump_1_1_api_1a60f41ef4f7e14d5ae1fb5f23b7e0244b
//public enum PrivacyOptionsRequirementStatus
//{
// Unknown,
// NotRequired,
// Required
//}
bool bIsPrivacyOptionsRequirement = false;
// 개인정보 보호 옵션을 표시해야 하는지 여부
switch (ConsentInformation.PrivacyOptionsRequirementStatus)
{
// 개인정보 보호 옵션이 표시되어야 함.
case PrivacyOptionsRequirementStatus.Required:
bIsPrivacyOptionsRequirement = true;
break;
// 개인정보 보호 옵션은 표시할 필요가 없음.
case PrivacyOptionsRequirementStatus.NotRequired:
bIsPrivacyOptionsRequirement = false;
break;
// 개인 정보 보호 옵션 요구 사항 상태를 알 수 없음.
case PrivacyOptionsRequirementStatus.Unknown:
bIsPrivacyOptionsRequirement = false;
break;
default:
bIsPrivacyOptionsRequirement = false;
break;
}
return bIsPrivacyOptionsRequirement;
}
public bool IsConsentForGDPR()
{
// [ConsentStatus enum 참조]
// https://developers.google.com/admob/unity/reference/namespace/google-mobile-ads/ump/api#namespace_google_mobile_ads_1_1_ump_1_1_api_1aa83ad2ecf6f2a08c584b60cef06f5133
//ConsentStatus
//{
// Unknown = 0, // Unknown consent status.
// NotRequired = 1, // Consent not required.
// Required = 2, // User consent required but not yet obtained.
// Obtained = 3 // User consent obtained, personalized vs non-personalized undefined.
//}
bool bIsConsentForGDPR = false;
switch (ConsentInformation.ConsentStatus)
{
case ConsentStatus.Unknown: // 동의 상태를 알 수 없습니다.
case ConsentStatus.Required: // 사용자 동의가 필요하지만 아직 획득되지 않았습니다.
case ConsentStatus.NotRequired: // 동의가 필요하지 않습니다.
bIsConsentForGDPR = false;
break;
case ConsentStatus.Obtained: // 사용자 동의 획득, 개인화 및 비개인화 정의되지 않음.
bIsConsentForGDPR = true;
break;
}
return bIsConsentForGDPR;
}
/// <summary>
/// Privacy(GDPR) Button 클릭해서 GDPR 동의 창 띄우기
/// </summary>
public void OnClickPrivacyButton()
{
UpdatePrivacyButton();
}
void PrivacyButton()
{
//// Enable the privacy settings button.
//if (_privacyButton != null)
//{
// _privacyButton.onClick.AddListener(UpdatePrivacyButton);
// // Disable the privacy settings button by default.
// _privacyButton.interactable = false;
//}
}
private void UpdatePrivacyButton()
{
// Logic for updating privacy options
ShowPrivacyOptionsForm(); // You might want to call your method to show the privacy options form here
Debug.LogFormat("[UMP][UpdatePrivacyButton] Privacy button clicked!");
}
/// <summary>
/// Shows the privacy options form to the user.
/// </summary>
public void ShowPrivacyOptionsForm()
{
Debug.Log("[UMP] Showing privacy options form.");
// PrivacyOptionsForm 무조건 팝업으로 변경[blueasa / 2023-12-14]
ConsentForm.ShowPrivacyOptionsForm((FormError showError) =>
//ConsentForm.LoadAndShowConsentFormIfRequired((FormError showError) =>
{
if (showError != null)
{
Debug.LogErrorFormat("[UMP][LoadAndShowConsentFormIfRequired] Error showing privacy options form with error: {0}", showError.Message);
}
else
{
// 버튼 상태 갱신(필요하면)
// Enable the privacy settings button.
//if (_privacyButton != null)
//{
// _privacyButton.interactable =
// ConsentInformation.PrivacyOptionsRequirementStatus ==
// PrivacyOptionsRequirementStatus.Required;
//}
}
});
}
void GDPRDebugger()
{
Debug.Log("[UMP] GDPRDebugger()");
///Summary
///Use this for debugging
///
// Define the test device ID for debugging
string testDeviceHashedId = "0B030C0B27FA3A0A7FCF5766D3BBBA1A"; // Replace with your actual test device ID
// Create debug settings for consent testing
var debugSettings = new ConsentDebugSettings
{
TestDeviceHashedIds = new List<string>
{
testDeviceHashedId
}
};
// Set the debug geography for testing in the EEA
debugSettings.DebugGeography = DebugGeography.EEA;
Debug.Log("[UMP] GDPRDebugger Set : DebugGeography.EEA");
// Set tag for under the age of consent.
// Here false means users are not under the age of consent.
ConsentRequestParameters request = new ConsentRequestParameters
{
TagForUnderAgeOfConsent = false,
ConsentDebugSettings = debugSettings,
};
// Check the current consent information status.
ConsentInformation.Update(request, OnConsentInfoUpdated);
}
#endregion
GoogleMobileAds iOS SDK 7.68 이상은 Firebase 7.x 이상에서 지원합니다.
Firebase 업데이트 하세요
Unity: 2019.4.8f1
AdMob v5.4.0
Firebase v6.16.1 (Messaging & Analytics)
Target minimum iOS Version 12.0
Problem
I can't build the project. XCode error:
../Libraries/Plugins/iOS/GADUAdLoader.h:5:9: 'GoogleMobileAds/GoogleMobileAds.h' file not found
When I trying to update pods terminal throw the next error:
[!] CocoaPods could not find compatible versions for pod "GoogleAppMeasurement":
In Podfile:
Firebase/Analytics (= 6.32.2) was resolved to 6.32.2, which depends on
Firebase/Core (= 6.32.2) was resolved to 6.32.2, which depends on
FirebaseAnalytics (= 6.8.2) was resolved to 6.8.2, which depends on
GoogleAppMeasurement (= 6.8.2)
Google-Mobile-Ads-SDK (~> 7.68) was resolved to 7.68.0, which depends on
GoogleAppMeasurement (~> 7.0)
Attempts
Add 'pod 'GoogleAppMeasurement', '7.0'' to Podfile.
Result
CocoaPods could not find compatible versions for pod "GoogleAppMeasurement":
In Podfile:
Firebase/Analytics (= 6.32.2) was resolved to 6.32.2, which depends on
Firebase/Core (= 6.32.2) was resolved to 6.32.2, which depends on
FirebaseAnalytics (= 6.8.2) was resolved to 6.8.2, which depends on
GoogleAppMeasurement (= 6.8.2)
Google-Mobile-Ads-SDK (~> 7.68) was resolved to 7.68.0, which depends on
GoogleAppMeasurement (~> 7.0)
GoogleAppMeasurement (= 7.0)
Uninstall and install cocoapods
Result
Same error
Project Podfile
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/CocoaPods/Specs'
platform :ios, '12.0'
target 'UnityFramework' do
pod 'Firebase/Analytics', '6.32.2'
pod 'Firebase/Core', '6.32.2'
pod 'Firebase/Messaging', '6.32.2'
pod 'Google-Mobile-Ads-SDK', '~> 7.68'
end
How can I resolve this problem?
[Answer]
Google-Mobile-Ads-SDKversion 7.68 is only compatible with Firebase 7.x. If you want to use Firebase 6.x, you need to use 7.67 or earlier.