문제

iPhone SDK 사용 3.1.2.

어쨌든 Bluetooth 헤드셋이 장치에 연결되어 있는지 아는 것이 있습니까? 연결된 경우를 제외하고는 정보가 필요하지 않습니다. 이것은 오디오 세션의 속성 리스너를 통해 어떤 것이 널리 퍼져 있는지 여부를 아는 것과 다릅니다.

감사

올바른 솔루션이 없습니다

다른 팁

블루투스 헤드셋이 연결되어 있는지 확인하려면이 방법을 호출하십시오.

먼저이 프레임 워크를 가져옵니다 #import <AVFoundation/AVFoundation.h>

- (BOOL) isBluetoothHeadsetConnected
    {
        AVAudioSession *session = [AVAudioSession sharedInstance];
        AVAudioSessionRouteDescription *routeDescription = [session currentRoute];

        NSLog(@"Current Routes : %@", routeDescription);

        if (routeDescription)
        {
            NSArray *outputs = [routeDescription outputs];

            if (outputs && [outputs count] > 0)
            {
                AVAudioSessionPortDescription *portDescription = [outputs objectAtIndex:0];
                NSString *portType = [portDescription portType];

                NSLog(@"dataSourceName : %@", portType);

                if (portType && [portType isEqualToString:@"BluetoothA2DPOutput"])
                {
                    return YES;
                }
            }
        }

        return NO;
    }

당신은 다음을 보셨습니까 : KaudiosessionProperty_audioroute?

이 게시물도 참조하십시오.

외부 헤드셋이 iPhone에 연결되어 있는지 어떻게 알 수 있습니까?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top