How do I know if my iPhone is working in / quiet mode?

How can I tell if the iPhone is actually in action mode? And is there a way to know if the headphones are connected?

Edit: This is also called silent mode in some parts of the world.

+2


source to share


1 answer


Here's an example at http://www.iphonedevsdk.com/forum/iphone-sdk-development/21456-detect-wheather-phone-silent-mode-ring-mode.html

Reproduced here by Narender Mugdal :



CFStringRef route;
UInt32 propertySize = sizeof(CFStringRef);
AudioSessionInitialize(NULL, NULL, NULL, NULL);
AudioSessionGetProperty(kAudioSessionProperty_Audi oRoute, &propertySize, &route);
NSString *outputString = (NSString*)route; 
//NSLog(@"%@", outputString);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message: outputString delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];
[alert show];
[alert release];

      

+3


source







All Articles