SDK Quảng cáo của Google trên thiết bị di động đang ở chế độ bảo trì. Để sử dụng các tính năng và bản cập nhật mới nhất, hãy migrate và thiết lập GMA Next-Gen SDK.
Google sử dụng công nghệ AI để dịch nội dung sang ngôn ngữ bạn ưu tiên. Bản dịch bằng AI có thể có lỗi.
Nếu chính sách này áp dụng cho bạn, thì ví dụ sau đây sẽ đặt tiêu đề, thông báo và văn bản nút để thông báo cho người dùng về việc chia sẻ dữ liệu:
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);
Thay thế nội dung sau:
TITLE: tiêu đề của hộp thoại đồng ý, ví dụ: Location data.
MESSAGE_TEXT: văn bản của hộp thoại đồng ý, ví dụ:
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: văn bản của nút trên hộp thoại đồng ý, ví dụ: OK.
APP_TAG: thẻ nhật ký của ứng dụng, ví dụ: MainActivity.
CONSENT_RECEIVED_LOG_MESSAGE: thông điệp nhật ký cần ghi lại khi người dùng đồng ý, ví dụ: Consent received.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 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"]]