Jika Anda meneruskan data lokasi presisi pengguna Anda ke Google, Kebijakan Penayang Google
memberi Anda persyaratan izin dan pemberitahuan.
Jika kebijakan ini berlaku untuk Anda, contoh berikut menetapkan judul, pesan, dan teks tombol untuk memberi tahu pengguna Anda tentang berbagi data:
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);
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: teks tombol dialog izin,
misalnya, OK.
APP_TAG: tag log aplikasi Anda, misalnya, MainActivity.
CONSENT_RECEIVED_LOG_MESSAGE: pesan log yang akan
direkam saat pengguna memberikan izin, misalnya, Consent received.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2026-10-03 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"]]