How to find out if Siri is active while using the application?

I have an audio application, and when it AVAudioSessionRouteChangeNotificationappears, the application sets up AV and tests for use with headphones, etc.

However, Siri activates AVAudioSessionRouteChangeNotification, but due to the AV configuration, Siri cannot be used by the user (it seems that the microphone does not work for her).

Is there any way to find out if Siri is the cause causing it AVAudioSessionRouteChangeNotification, so I am not calling the method to configure AV if it is Siri and thus allows the user to use Siri?

+4
source share
2 answers

, / , Siri AVAudioSessionRouteChangeNotification, AVAudioSessionRouteChangeReasonKey,

, : AVAudioSessionRouteChangeReasonNewDeviceAvailable

, : AVAudioSessionRouteChangeReasonOldDeviceUnavailable

Siri, : AVAudioSessionRouteChangeReasonCategoryChange

+1

AVAudioSessionRouteChangeNotification, Siri:

AVAudioSessionRouteChangeReason routeChangeReason = [note.userInfo[AVAudioSessionRouteChangeReasonKey] integerValue];
AVAudioSessionRouteDescription* description = note.userInfo[AVAudioSessionRouteChangePreviousRouteKey];

BOOL isSiriStart = (routeChangeReason == AVAudioSessionRouteChangeReasonCategoryChange && description.inputs == nil);
BOOL isSiriFinish = (routeChangeReason == AVAudioSessionRouteChangeReasonCategoryChange && description.inputs != nil);
0

All Articles