Se você transmitir dados de local exato dos seus usuários ao Google, as
Políticas do Google para Publishers
vão fornecer requisitos de consentimento e um aviso.
Se essa política se aplica a você, o exemplo a seguir define o título, a mensagem
e o texto do botão para informar os usuários sobre o compartilhamento de dados pessoais:
Kotlin
protectedfunpresentConsentOverlay(context:Context){AlertDialog.Builder(context).setTitle("TITLE").setMessage("MESSAGE_TEXT").setNeutralButton("BUTTON_TEXT"){dialog,which->dialog.cancel()Log.d("APP_TAG","CONSENT_RECEIVED_LOG_MESSAGE")}.show()}// To use the previous function, call:presentConsentOverlay(this)
Java
protectedvoidpresentConsentOverlay(Contextcontext){newAlertDialog.Builder(context).setTitle("TITLE").setMessage("MESSAGE_TEXT").setNeutralButton("BUTTON_TEXT",newDialogInterface.OnClickListener(){@OverridepublicvoidonClick(DialogInterfacedialog,intwhich){dialog.cancel();Log.d("APP_TAG","CONSENT_RECEIVED_LOG_MESSAGE");}}).show();}// To use the previous method, call:presentConsentOverlay(this);
Substitua:
TITLE: o título da caixa de diálogo de consentimento, por exemplo,
Location data.
MESSAGE_TEXT: o texto da caixa de diálogo de consentimento, por
exemplo:
We may use your location and share with third parties for the
purposes of personalized advertising, analytics, and attributions. To learn
more, visit our privacy policy at example.com.
BUTTON_TEXT: o texto do botão da caixa de diálogo de consentimento,
por exemplo, OK.
APP_TAG: a tag de registro do aplicativo, por
exemplo, MainActivity.
CONSENT_RECEIVED_LOG_MESSAGE: a mensagem de registro a ser
registrada quando o usuário der o consentimento, por exemplo, Consent received.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2026-10-16 UTC."],[],["Google's updated Publisher Policies require publishers to notify users about sharing precise location data for ads. Publishers must obtain user consent for this data sharing. Example code snippets in Kotlin and Java are provided to show how to inform users via a consent overlay. The code displays a message stating that the app may use and share user location for personalized advertising, analytics, and attribution, and directs users to the privacy policy for further information. Customization of the provided code is needed.\n"]]