หากคุณส่งข้อมูลตำแหน่งที่แน่นอนของผู้ใช้ไปยัง 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.CONSENT_RECEIVED_LOG_MESSAGE: ข้อความในบันทึกที่จะ บันทึกเมื่อผู้ใช้ให้ความยินยอม เช่นConsent received