Kebijakan data lokasi presisi

Jika Anda meneruskan data lokasi presisi pengguna Anda ke Google, Kebijakan Penayang Google memberi Anda persyaratan izin dan pemberitahuan.

Jika kebijakan ini berlaku untuk Anda, contoh berikut menetapkan judul, pesan, dan teks tombol untuk memberi tahu pengguna Anda tentang berbagi data:

Kotlin

protected fun presentConsentOverlay(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

protected void presentConsentOverlay(Context context) {
  new AlertDialog.Builder(context)
      .setTitle("TITLE")
      .setMessage("MESSAGE_TEXT")
  .setNeutralButton("BUTTON_TEXT", new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      dialog.cancel();
      Log.d("APP_TAG", "CONSENT_RECEIVED_LOG_MESSAGE");
    }
  })
  .show();
}

// To use the previous method, call:
presentConsentOverlay(this);

Ganti kode berikut:

  • TITLE: judul dialog izin, misalnya, Location data.
  • MESSAGE_TEXT: teks dialog izin, misalnya:

    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: teks tombol dialog izin, misalnya, OK.

  • CONSENT_RECEIVED_LOG_MESSAGE: pesan log yang akan direkam saat pengguna memberikan izin, misalnya, Consent received.