Stay organized with collections
Save and categorize content based on your preferences.
Recent updates to the Google Publisher
Policies
have introduced new notice and consent requirements for publishers who pass
precise location data of users to Google, for ads-related purposes.
If this policy applies to you, the following snippet shows one way you could
inform your users of this data sharing:
Kotlin
protected fun presentConsentOverlay(context: Context) {
AlertDialog.Builder(context)
.setTitle("Location data")
.setMessage("We may use your location, " +
"and share it with third parties, " +
"for the purposes of personalized advertising, " +
"analytics, and attribution. " +
"To learn more, visit our privacy policy " +
"at https://myapp.com/privacy.")
.setNeutralButton("OK") { dialog, which ->
dialog.cancel()
// TODO: replace the below log statement with code that specifies how
// you want to handle the user's acknowledgement.
Log.d("MyApp", "Got consent.")
}
.show()
}
// To use the above function:
presentConsentOverlay(this)
Java
protected void presentConsentOverlay(Context context) {
new AlertDialog.Builder(context)
.setTitle("Location data")
.setMessage("We may use your location, " +
"and share it with third parties, " +
"for the purposes of personalized advertising, " +
"analytics, and attribution. " +
"To learn more, visit our privacy policy " +
"at https://myapp.com/privacy.")
.setNeutralButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
// TODO: replace the below log statement with code that specifies how
// you want to handle the user's acknowledgement.
Log.d("MyApp", "Got consent.");
}
})
.show();
}
// To use the above method:
presentConsentOverlay(this);
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-21 UTC."],[[["Google Publisher Policies now require publishers to obtain user consent before sharing precise location data for ads."],["Publishers need to clearly inform users about how their location data will be used, including personalized advertising, analytics, and attribution."],["Sample code snippets in Kotlin and Java demonstrate how to create a consent overlay to inform users and obtain their acknowledgement."],["Publishers must customize the provided snippets to accurately reflect their specific data sharing practices for compliance."]]],[]]