Skip to content

Instantly share code, notes, and snippets.

@BerkeCoban
Last active March 11, 2022 13:25
Show Gist options
  • Save BerkeCoban/447d08de0fa31afb253c64500a276471 to your computer and use it in GitHub Desktop.
Save BerkeCoban/447d08de0fa31afb253c64500a276471 to your computer and use it in GitHub Desktop.
/**
* TCF2.0
*/
val adParamBuilder = AdParam.Builder()
try {
val sharedPref = context.getSharedPreferences(
"SharedPreferences",
Context.MODE_PRIVATE
)
val tcfString = sharedPref?.getString("IABTCF_TCString", "");
if (tcfString != null && tcfString != "") {
adParamBuilder.setConsent(tcfString)
Log.d(ADAPTER_NAME, "TCF 2.0 string has been set.")
}
} catch (exception: Exception) {
Log.e(ADAPTER_NAME, "Tcf String couldn't read.")
}
// call AdParam.Builder().Build() afterwards and use it for adrequests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment