사용자의 정확한 위치 데이터를 Google에 전달하는 경우 Google 게시자 정책 에서 동의 요건과 고지를 제공합니다.
이 정책이 적용되는 경우 다음 예에서는 제목, 메시지, 버튼 텍스트를 설정하여 사용자에게 데이터 공유를 알립니다.
Swift
func presentConsentOverlayFromViewController(_ rootViewController: UIViewController) { if (rootViewController == nil) { return; } DispatchQueue.main.async { let alert = UIAlertController(title: "TITLE", message: "MESSAGE_TEXT", preferredStyle: .alert) let alertAction = UIAlertAction(title: "BUTTON_TEXT", style: .default, handler: { _ in print("CONSENT_RECEIVED_LOG_MESSAGE") } ) alert.addAction(alertAction) rootViewController.present(alert, animated: true, completion: nil) } } // To use the previous function, and if you are in a view controller, call: presentConsentOverlayFromViewController(self)
Objective-C
- (void)presentConsentOverlayFromViewController:(UIViewController *)rootViewController { if (rootViewController == nil) { return; } dispatch_async(dispatch_get_main_queue(), ^{ UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"TITLE" message: @"MESSAGE_TEXT" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *ok = [UIAlertAction actionWithTitle:@"BUTTON_TEXT" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { [alert dismissViewControllerAnimated:YES completion:^{ NSLog(@"CONSENT_RECEIVED_LOG_MESSAGE"); }]; }]; [alert addAction:ok]; [rootViewController presentViewController:alert animated:YES completion:nil]; }); } // To use the previous function, and if you are in a view controller, call: [self presentConsentOverlayFromViewController:self];
다음을 바꿉니다.
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)