diff --git a/Runtime/Code/Config/GuruServicesConfig.cs b/Runtime/Code/Config/GuruServicesConfig.cs
index 0f43e98..0ca4d99 100644
--- a/Runtime/Code/Config/GuruServicesConfig.cs
+++ b/Runtime/Code/Config/GuruServicesConfig.cs
@@ -55,6 +55,7 @@ namespace Guru
public double Tch02Value() => parameters?.tch_020 ?? 0;
public bool IsAppReview() => parameters?.apple_review ?? false;
public bool EnableErrorLog() => parameters?.enable_errorlog ?? false;
+ public bool IsAdsCompliance() => parameters?.ads_compliance ?? false;
public bool DMACountryCheck() => parameters?.dma_country_check ?? false;
public string DMAMapRule() => parameters?.dma_map_rule ?? "";
public bool UseUUID() => parameters?.using_uuid ?? false;
@@ -95,6 +96,7 @@ namespace Guru
public bool dma_country_check = false;
public bool apple_review = false; // 苹果审核标志位
public bool enable_errorlog = false;
+ public bool ads_compliance = false;
}
[Serializable]
diff --git a/Runtime/Code/SDK/GuruSDK.Ads.cs b/Runtime/Code/SDK/GuruSDK.Ads.cs
index e9e774a..2704ba8 100644
--- a/Runtime/Code/SDK/GuruSDK.Ads.cs
+++ b/Runtime/Code/SDK/GuruSDK.Ads.cs
@@ -80,6 +80,7 @@ namespace Guru
#region Guru Consent
private bool _hasConsentCalled = false;
+ private bool _adServiceHasStarted = false;
///
/// 启动Consent流程
@@ -87,6 +88,12 @@ namespace Guru
///
private void StartConsentFlow()
{
+ if (!_adServiceHasStarted)
+ {
+ var time = _appServicesConfig.IsAdsCompliance() ? 10 : 1f; // 启动合规判定后, 延迟最多 10 秒后启动广告
+ Delay(time, AdServiceHandler); // 广告延迟启动
+ }
+
if (_hasConsentCalled) return;
_hasConsentCalled = true;
@@ -113,7 +120,7 @@ namespace Guru
{
// 无论状态如何, 都在回调内启动广告初始化
- StartAdService(_adInitSpec);
+ AdServiceHandler();
// 调用回调
Callbacks.ConsentFlow._onConsentResult?.Invoke(code);
@@ -132,7 +139,17 @@ namespace Guru
break;
}
}
-
+
+ ///
+ /// 启动广告服务
+ ///
+ private void AdServiceHandler()
+ {
+ if (_adServiceHasStarted) return;
+ _adServiceHasStarted = true;
+ StartAdService(_adInitSpec);
+ }
+
#endregion
#region IOS ATT 广告授权流程