精确位置数据政策

如果您向 Google 传递用户的精确位置数据,Google 发布商政策会为您提供用户意见征求要求和通知。

如果该政策适用于您,以下示例会设置标题、消息和按钮文本,以告知用户数据共享情况:

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

替换以下内容:

  • 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。