Possible Duplicate:
Detect Silent mode in iOS5?
i have used the code below to check if silent mode is on, it works as expected on the iPhone but on the iPad it returns speaker regardless.
CFStringRef state;
UInt32 propertySize = sizeof(CFStringRef);
AudioSessionInitialize(NULL, NULL, NULL, NULL);
AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &propertySize, &state);
if (CFStringGetLength(state) == 0) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Silent mode"
message:@"Please turn sound on"
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
[alert release];
}
Any ideas how to modify it to work universally?
Thanks
Dan.