ios - AudioSessionGetProperty deprecated, how to know device is silenced -
i'm trying detect user's device silenced or not ( button on side of phone ). found method detect this, audiosessiongetproperty deprecated in ios7.
- (bool)deviceissilenced { cfstringref state; uint32 propertysize = sizeof(cfstringref); osstatus audiostatus = audiosessiongetproperty(kaudiosessionproperty_audioroute, &propertysize, &state); if (audiostatus == kaudiosessionnoerror) { nslog(@"audio route: %@", state) // "speaker" regardless of silent switch setting, "headphone" when headphones plugged in return (cfstringgetlength(state) <= 0); } return no; }
anyone got solution this?
according sound switch, there no public api detect state of silent switch, provide hack (using public apis , therefore believed ok ap store approval, still treated caution):
http://sharkfood.com/content/developers/content/sound%20switch/
Comments
Post a Comment