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
protectedfunpresentConsentOverlay(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
protectedvoidpresentConsentOverlay(Contextcontext){newAlertDialog.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",newDialogInterface.OnClickListener(){@OverridepublicvoidonClick(DialogInterfacedialog,intwhich){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);