Google 发布商近期更新 政策 针对符合以下条件的发布商推出了新的通知和用户意见征求要求: 向 Google 传送用户的确切位置数据,以用于广告相关目的。
如果此政策适用于您,以下代码段展示了您可以采取的 告知用户此数据共享情况:
Kotlin
protected fun presentConsentOverlay(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
protected void presentConsentOverlay(Context context) { new 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", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int 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 method: presentConsentOverlay(this);