How to read IABTCF_AddtlConsent in unity ?

181 views
Skip to first unread message

Suraj Kumar G R

unread,
Jan 2, 2024, 6:29:24 AMJan 2
to Google Mobile Ads SDK Developers
Hi,

Need help to read `IABTCF_AddtlConsent` in unity to pass consent to other vendors. 
I tried string CMPString = PlayerPrefs.GetString("IABTCF_AddtlConsent");   as mentioned here. but it is empty after getting consent but I see value in debug logs. 

Regards,
Suraj.

Suraj Kumar G R

unread,
Jan 2, 2024, 6:34:25 AMJan 2
to Google Mobile Ads SDK Developers
I see this in logs 

D UserMessagingPlatform: Writing to storage: [IABTCF_AddtlConsent] 1~2072.70.89.93.108.122.149.196.2253.2299.259.2328.2331.2357.311.313.317.323.2373.338.358.2415.385.415.449.2506.2526.482.486.494.495.2567.2568.2571.2572.2575.540.574.2624.609.2677.2710.2878.2898.864.981.1029.1048.1051.3100.1067.1095.1097.3234.1201.1205.1211.1276.1301.1329.1344.1365.1415.1449.1451.1516.1570.1577.1598.1616.1651.1716.1735.1753.1765.1782.1870.1878.1889.1917.1958.1960.1985

Mobile Ads SDK Forum Advisor

unread,
Jan 2, 2024, 6:54:59 AMJan 2
to su...@stellarplay.games, google-adm...@googlegroups.com

Hi Suraj,

Thank you for contacting the Mobile Ads SDK Support team.

I will check with our team regarding your query and one of my team members will reach out to you once we have an update on this. Meanwhile, your patience is highly appreciated.

This message is in relation to case "ref:!00D1U01174p.!5004Q02r4mVP:ref"

Thanks,
 
Google Logo Mobile Ads SDK Team

 

Luis Gualandi

unread,
Jan 2, 2024, 9:46:25 PMJan 2
to Google Mobile Ads SDK Developers
            #if UNITY_ANDROID
                AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
                AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
                AndroidJavaClass preferenceManagerClass = new AndroidJavaClass("android.preference.PreferenceManager");
                AndroidJavaObject sharedPreferences = preferenceManagerClass.CallStatic<AndroidJavaObject>("getDefaultSharedPreferences", currentActivity);
                tcString = sharedPreferences.Call<string>("getString", "IABTCF_AddtlConsent", "");
            #elif UNITY_IOS
                tcString = PlayerPrefs.GetString("IABTCF_AddtlConsent");
            #endif

Suraj Kumar G R

unread,
Jan 2, 2024, 11:37:47 PMJan 2
to Google Mobile Ads SDK Developers
I'll try this. Thanks Luis.
Reply all
Reply to author
Forward
0 new messages