אם המדיניות הזו חלה עליך, בדוגמה הבאה מוגדרים הכותרת, ההודעה וטקסט הלחצן כדי ליידע את המשתמשים על שיתוף הנתונים:
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);
מחליפים את מה שכתוב בשדות הבאים:
TITLE: הכותרת של תיבת הדו-שיח להבעת הסכמה, לדוגמה, Location data.
MESSAGE_TEXT: הטקסט של תיבת הדו-שיח להסכמה, לדוגמה:
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: הטקסט של הכפתור בתיבת הדו-שיח לבקשת הסכמה, לדוגמה, OK.
APP_TAG: תג היומן של האפליקציה, לדוגמה, MainActivity.
CONSENT_RECEIVED_LOG_MESSAGE: הודעת היומן שצריך לתעד כשהמשתמש נותן הסכמה, לדוגמה, Consent received.
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 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"]]