사용자의 정확한 위치 데이터를 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)
자바
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).