diff --git a/Runtime/GuruConsent/Editor/PostBuildProcess/PostBuild.Android.DMA.cs b/Runtime/GuruConsent/Editor/PostBuildProcess/PostBuild.Android.DMA.cs
index 642173e..bda35e8 100644
--- a/Runtime/GuruConsent/Editor/PostBuildProcess/PostBuild.Android.DMA.cs
+++ b/Runtime/GuruConsent/Editor/PostBuildProcess/PostBuild.Android.DMA.cs
@@ -1,4 +1,3 @@
-
#if UNITY_ANDROID
namespace Guru.Editor
@@ -32,6 +31,9 @@ namespace Guru.Editor
*
--------------------------------------------------------------------------------*/
+
+ public static bool DefaultValue = true; // default value
+
///
/// 修复 AndroidManifest.xml
///
@@ -51,7 +53,7 @@ namespace Guru.Editor
int[] flags = new int[] { 0, 0, 0, 0 };
- string defaultValue = "true"; // 日后可能会进行修改
+ string defaultValue = DefaultValue.ToString().ToLower();
if (File.Exists(filePath))
{
@@ -68,7 +70,7 @@ namespace Guru.Editor
var list = app.SelectNodes("meta-data");
- // 刷新已有属性
+ // ----- refresh exist values --------
foreach (XmlElement item in list)
{
for(int i = 0; i < dma_keys.Length; i++)
@@ -81,17 +83,26 @@ namespace Guru.Editor
}
}
- // 补全缺失属性
+ // ------ Inject metadata -----------
for (int i = 0; i < flags.Length; i++)
{
if (flags[i] == 0)
{
var node = doc.CreateElement("meta-data");
- node.SetAttribute("name", namespace_uri,dma_keys[i]);
+ node.SetAttribute("name", namespace_uri, dma_keys[i]);
node.SetAttribute("value", namespace_uri, defaultValue);
app.AppendChild(node);
}
}
+
+ // ------- Delay Measurement ------------
+ if (GoogleDMAHelper.UsingDelayAppMeasurement)
+ {
+ var node = doc.CreateElement("meta-data");
+ node.SetAttribute("name", namespace_uri, "com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT");
+ node.SetAttribute("value", namespace_uri, "true");
+ app.AppendChild(node);
+ }
doc.Save(filePath);
Debug.Log($"[Post] inject AndroidManifest.xml at {filePath} success.");
diff --git a/Runtime/GuruConsent/Editor/PostBuildProcess/PostBuild.iOS.DMA.cs b/Runtime/GuruConsent/Editor/PostBuildProcess/PostBuild.iOS.DMA.cs
index d0e100d..884364c 100644
--- a/Runtime/GuruConsent/Editor/PostBuildProcess/PostBuild.iOS.DMA.cs
+++ b/Runtime/GuruConsent/Editor/PostBuildProcess/PostBuild.iOS.DMA.cs
@@ -1,6 +1,5 @@
-
-
#if UNITY_IOS
+
namespace Guru.Editor
{
using UnityEditor;
@@ -12,7 +11,7 @@ namespace Guru.Editor
public class PostBuild_DMA
{
- public static bool DefaultValue = true; // 配置注入默认值
+ public static bool DefaultValue = true; // default value
[PostProcessBuild]
public static void OnPostProcessBuild(BuildTarget target, string buildPath)
@@ -20,7 +19,7 @@ namespace Guru.Editor
if (target != BuildTarget.iOS) return;
SetInfoPlist(buildPath);
}
-
+
///
/// inject default values
///
@@ -38,24 +37,26 @@ namespace Guru.Editor
plist.ReadFromFile(infoPlistPath);
var root = plist.root;
- root.SetBoolean("GADDelayAppMeasurementInit", true);
+
+ //--------- Add Delay Measurement ---------------
+ if (GoogleDMAHelper.UsingDelayAppMeasurement)
+ {
+ root.SetBoolean("GADDelayAppMeasurementInit", true);
+ }
+
//--------- set all default values ----------
root.SetBoolean("GOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_STORAGE", DefaultValue);
root.SetBoolean("GOOGLE_ANALYTICS_DEFAULT_ALLOW_ANALYTICS_STORAGE", DefaultValue);
root.SetBoolean("GOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_PERSONALIZATION_SIGNALS", DefaultValue);
root.SetBoolean("GOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_USER_DATA", DefaultValue);
-
+
plist.WriteToFile(infoPlistPath);
-
- Debug.Log($"[Post] consent has inject dma default values {DefaultValue} to {infoPlistPath} ");
+
+ Debug.Log(
+ $"[Post] consent has inject dma default values {DefaultValue} to {infoPlistPath} ");
}
-
-
-#endif
-
-
-
-
}
-}
\ No newline at end of file
+}
+
+#endif
\ No newline at end of file
diff --git a/Runtime/GuruConsent/Runtime/Script/Consent/GoogleDMAHelper.cs b/Runtime/GuruConsent/Runtime/Script/Consent/GoogleDMAHelper.cs
index c8aa45d..9ed2d97 100644
--- a/Runtime/GuruConsent/Runtime/Script/Consent/GoogleDMAHelper.cs
+++ b/Runtime/GuruConsent/Runtime/Script/Consent/GoogleDMAHelper.cs
@@ -14,6 +14,7 @@ namespace Guru
///
public class GoogleDMAHelper
{
+ public static readonly bool UsingDelayAppMeasurement = false;
///
/// Set DMA status
diff --git a/package.json b/package.json
index 6e5d59b..6e6bdfd 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "com.guru.unity.sdk.core",
"displayName": "Guru SDK Core",
- "version": "2.1.1",
+ "version": "2.2.0",
"description": "Guru SDK core for Unity developers",
"unity": "2021.3",
"author":{