Chính sách về dữ liệu vị trí chính xác

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 chính sách này áp dụng cho bạn, thì đoạn mã dưới đây cho thấy một cách để bạn có thể thông báo cho người dùng về việc chia sẻ dữ liệu này:

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);

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)