자체 AI 인증 결과 보고
reportSelfAiServiceAuthResult는 인증 API가 아니라 기기 흐름을 동기화하기 위한 신호입니다. 앱이 자체 AI 서비스를 연동하면 해당 서비스를 독립적으로 인증한 뒤 결과를 연결된 기기에 보고합니다.
기기는 자체 AI 인증 성공 결과를 받은 뒤에야 지원되는 AI 절차를 계속합니다. 결과를 보고하지 않으면 호스트 서비스가 준비되어 있어도 기기의 AI 경로는 차단된 상태로 남을 수 있습니다. 예를 들어 세션에 필요한 Opus 음성 스트림을 시작하지 않을 수 있습니다.
이 API가 필요한 경우
호스트 앱에서 직접 연동하고 인증하는 AI 서비스에 이 API를 사용하세요. 호스트 인증이 끝나면 다음과 같이 처리합니다.
- 자체 AI 서비스를 사용할 준비가 끝난 뒤에만
true를 보고합니다. - 인증에 실패했거나 서비스를 사용할 수 없으면
false를 보고합니다. - completion handler가 성공해야 결과가 기기에 전달된 것으로 처리합니다.
SDK에서 제공하는 AI 서비스 인증은 자체 연동 흐름을 따릅니다. 호스트 앱이 이 API를 서비스 인증 대신 사용할 필요는 없습니다.
API 참고
- Swift
- Objective-C
/// Reports the authentication result for the self-AI service.
/// - Parameters:
/// - isAuthenticated: Whether the self-AI service is authenticated.
/// - completion: A closure that is called when the operation completes.
/// - success: `true` if the operation was successful; otherwise `false`.
/// - error: An `NSError` object that describes the error that occurred, or `nil` if the operation was successful.
func reportSelfAiServiceAuthResult(
_ isAuthenticated: Bool,
completion: AIBudsCompletionHandler?
)/// Reports the authentication result for the self-AI service.
- (void)reportSelfAiServiceAuthResult:(BOOL)isAuthenticated
completion:(AIBudsCompletionHandler _Nullable)completion;reportSelfAiServiceAuthResult를 참고하세요.
사용 예제
- Swift
- Objective-C
func selfAIAuthenticationDidFinish(isAuthenticated: Bool) {
guard let device = device as? DeviceServiceAuthAPI else { return }
// Report the result only after the host app's own AI authorization finishes.
device.reportSelfAiServiceAuthResult(isAuthenticated) { reportSucceeded, error in
guard reportSucceeded else {
print(error?.localizedDescription ?? "Failed to report authorization")
return
}
if isAuthenticated {
// The device can now continue eligible AI flows, including an Opus input stream.
print("Self-AI authorization delivered to the device")
}
}
}- (void)selfAIAuthenticationDidFinish:(BOOL)isAuthenticated {
id<AIBudsDeviceServiceAuthAPI> device = (id<AIBudsDeviceServiceAuthAPI>)self.device;
if (![device conformsToProtocol:@protocol(AIBudsDeviceServiceAuthAPI)])
return;
// Report the result only after the host app's own AI authorization finishes.
[device reportSelfAiServiceAuthResult:isAuthenticated
completion:^(BOOL reportSucceeded, NSError *error) {
if (!reportSucceeded) {
NSLog(@"%@", error.localizedDescription);
return;
}
if (isAuthenticated) {
// The device can now continue eligible AI flows, including
// an Opus input stream.
NSLog(@"Self-AI authorization delivered to the device");
}
}];
}completion handler는 결과가 기기에 전달되었는지만 보고하며 AI 서비스를 인증하지 않습니다. 이 API는 Boolean 결과만 받으므로 access token이나 인증 정보를 절대 전달하지 마세요.