Is there a way to determine the setting of the Ring/Silent switch on the iPhone -
i trying figure out code whether ring/silent switch on ring or silent. there way determine program.
thanks
i did more searching , found same question here how detect iphone on silent mode.
for completeness, here answer neil worked me?
cfstringref state = nil; uint32 propertysize = sizeof(cfstringref); audiosessioninitialize(null, null, null, null); osstatus status = audiosessiongetproperty(kaudiosessionproperty_audioroute, &propertysize, &state); if (status == kaudiosessionnoerror) { return (cfstringgetlength(state) == 0); // yes = silent } return no;
it should noted not work if headphones connected. "headphone". reported coob.
Comments
Post a Comment