Để thảo luận và đưa ra ý kiến phản hồi về các sản phẩm của chúng tôi, hãy tham gia kênh Discord chính thức của AdMob trong máy chủ Cộng đồng quảng cáo và đo lường của Google.
Thay đổi gần đây về Các chính sách dành cho nhà xuất bản của Google
đã đặt ra yêu cầu mới về việc thông báo và lấy sự đồng ý cho những nhà xuất bản chuyển dữ liệu vị trí chính xác của người dùng đến Google cho các mục đích liên quan đến quảng cáo.
Nếu bạn phải tuân thủ chính sách này, thì đoạn mã sau đây là một cách để bạn có thể thông báo cho người dùng biết về hoạt động chia sẻ dữ liệu này:
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);
[null,null,["Cập nhật lần gần đây nhất: 2025-08-31 UTC."],[[["\u003cp\u003eGoogle Publisher Policies now require publishers to obtain user consent before passing precise location data for ads-related purposes.\u003c/p\u003e\n"],["\u003cp\u003ePublishers need to clearly inform users about how their precise location data is being used and shared with third parties, such as for personalized advertising, analytics, and attribution.\u003c/p\u003e\n"],["\u003cp\u003eThe provided code snippets offer examples of how to present a consent overlay to users, but they need to be customized to accurately reflect each publisher's specific data sharing practices.\u003c/p\u003e\n"],["\u003cp\u003ePublishers should replace the placeholder comments in the code snippets with their own logic for handling user acknowledgement of the data sharing disclosure.\u003c/p\u003e\n"]]],["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"],null,["# Precise location data policy\n\nSelect platform: [Android](/admob/android/privacy/precise-location \"View this page for the Android platform docs.\") [iOS](/admob/ios/privacy/precise-location \"View this page for the iOS platform docs.\")\n\n\u003cbr /\u003e\n\nRecent updates to the [Google Publisher\nPolicies](//support.google.com/adsense/answer/9335564#use_of_device_and_location_data)\nhave introduced new notice and consent requirements for publishers who pass\nprecise location data of users to Google, for ads-related purposes.\n\nIf this policy applies to you, the following snippet shows one way you could\ninform your users of this data sharing: \n\n### Kotlin\n\n```kotlin\nprotected fun presentConsentOverlay(context: Context) {\n AlertDialog.Builder(context)\n .setTitle(\"Location data\")\n .setMessage(\"We may use your location, \" +\n \"and share it with third parties, \" +\n \"for the purposes of personalized advertising, \" +\n \"analytics, and attribution. \" +\n \"To learn more, visit our privacy policy \" +\n \"at https://myapp.com/privacy.\")\n .setNeutralButton(\"OK\") { dialog, which -\u003e\n dialog.cancel()\n // TODO: replace the below log statement with code that specifies how\n // you want to handle the user's acknowledgement.\n Log.d(\"MyApp\", \"Got consent.\")\n }\n .show()\n}\n\n// To use the above function:\npresentConsentOverlay(this)\n```\n\n### Java\n\n```java\nprotected void presentConsentOverlay(Context context) {\n new AlertDialog.Builder(context)\n .setTitle(\"Location data\")\n .setMessage(\"We may use your location, \" +\n \"and share it with third parties, \" +\n \"for the purposes of personalized advertising, \" +\n \"analytics, and attribution. \" +\n \"To learn more, visit our privacy policy \" +\n \"at https://myapp.com/privacy.\")\n .setNeutralButton(\"OK\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n dialog.cancel();\n // TODO: replace the below log statement with code that specifies how\n // you want to handle the user's acknowledgement.\n Log.d(\"MyApp\", \"Got consent.\");\n }\n })\n .show();\n}\n\n// To use the above method:\npresentConsentOverlay(this);\n```\n| **Key Point:** This snippet is only an example. Make sure to customize the snippet to accurately reflect your data sharing practices, so users are informed of all the relevant purposes for which you share their precise location data."]]