How to mute iPhone running iOS 5 - iphone

I know this question is already asked quite some time. And I read all the topics at stackoverflow.
But there isn't a satisfying answer to my problem.
I'd like to mute my iPhone running iOS 5 programmatically. Many would say it isn't possible with public frameworks. I'm aware of that. The App I'm planning to code is for personal use only. I do not intend to sell it over the AppStore (yet?).
My research brought me to the conclusion, that there my be several ways to achieve muting an iPhone programmatically.
Use private frameworks
Hook functions or methods which are playing sounds
Replace default sounds (like ringtone, MailSent, iMessage, usw...)
Some thoughts to the above mentioned methods:
I class-dumped all headers of the private frameworks (in my Xcode-Installation) and didn't find functions which indicate (by their function name) to the wanted behavior
I think it's possible, but I do not know the functions to be hooked. Therefore, it would be quite some effort for to make this work (and I think I do not want to do this)
Giving it a second thought, this might not be a good solution. Maybe you can change the sounds. But then the phone isn't mute at all (games, YouTube,...)
I had given AVSystemController a chance using the methods changeActiveCategoryVolumeBy and setVolumeTo but those won't mute my phone but set the minimal volume of the ringer to 0.06 (or something).
There has to be a way to completely mute the iPhone, RingToggle (jailbroken app) is doing it quite good.
Does anyone has a idea how to do it?

I don't think you'll be able to mute the phone from a sandboxed app, even using private frameworks.
What RingToggle probably does is hook into the springboard and use springboard's methods to mute the phone; they are probably using a MobileSubstrate extension.

Related

Headphone jack changes and pauses songs

I shake my iphone headphone jack and it changes the song on my nano iPod 7th gen and I move it in circles and it also changes the song or pauses it I take out lint get still does it I don't understand is it programmed to act this way I use any other headphones doesnt act the same way I've already used two iPhone head phones still does it if the headphones aren't Apple related it won't do it
Are your headphones the kind with a build in mic/controller? I had a similar issue happen to me with my iPhone recently - it was to do with a poor connection or fraying within the headphones themselves. After trying a new set, the problem stopped. If as you say it only happens with one set of headphones - the issue is likely the headphones, rather than the iPod/iPhone.
Check also that the headphones you have are designed for use with Apple devices - it seems a bit much, but recently with more functionality being allowed via a simple interface, different manufacturers (ie: Samsung/Apple) have different standards for how they treat different events from this controller.
Finally - note that this is a community site for developers - aspiring and professional alike (I fall into the former at the moment!). your question perhaps may be better suited to the Apple website forums, rather than here. Hope this helps all the same.

iPhone turn off bluetooth GKPeerPickerController

I agree that this question is duplicate. Please bear with me. I was also among you all to believe that is not possible to programatically turn on/off bluetooth.
But using GKPeerPickerController if bluetooth is not on user will be prompted to turn it on. Fair enough to turn on the bluetooth.
I was betting with my belief that we can not turn off the bluetooth programatically as there is no way. But this application does that so I didn't had choice to refuse.
I just want to confirm whether it is possible or not and if yes how to turn off the bluetooth using GKPeerPickerController or any other public api way ?
I know this isn't the answer you want, but no, you can't turn off bluetooth programmatically with Apple-approved APIs.
There have been a number of apps approved on the App Store this year that have done this.
But, they keep getting removed by Apple shortly after release, once they (Apple) realize what's going on. They're certainly using private APIs.
Either developers are foolish enough to think that they won't be noticed, or they are simply hoping to pull in a couple weeks of revenue before Apple pulls the app, which could be enough to pay back their cost, with some profit.
The issue is that there's a number of ways to check whether an app is using private APIs. If developers are using objective-C frameworks in the normal way, that's an easy check. In fact, Xcode does some of this automatically when you use it to upload app binaries to iTunes Connect. But, it's not a complete check. Once at Apple, the reviewers perform another check, which I've been able to deduce is more sophisticated than what Xcode does.
However, that check is still not perfect, and I'm of the opinion that it's not necessarily a matter of a lazy reviewer just forgetting to perform the check. Objective-C gives you some techniques for obfuscating method calls. Depending on how you use these techniques, you might get past the reviewers . In my experience, I have every reason (wink, wink) to believe that Apple is not running every app on a fully instrumented version of iOS, which could log all function calls, and defeat even the best attempt to hide private API usage via obfuscation techniques.
So, I can pretty much guarantee you that this explains the apps you've found on the App Store that turn off Bluetooth. Public GameKit APIs let you turn Bluetooth on, but not off.
Disclaimer: I've never worked for Apple, and no Apple insiders gave me information. But, I have gotten private APIs through the review process.
Please try below code and I think it will also work for you.
Class BluetoothManagerClass = objc_getClass( "BluetoothManager" );
BluetoothManager *btCont; = [BluetoothManagerClass sharedInstance];
[btCont setPowered:NO];
You need to add BluetoothManager class/framework in your project.
Thanks

Is it possible to write an application that plays music in the background on iOS using Adobe Packager for iPhone?

I would like my application to be able to remain running while the user goes and uses another application. (It will be playing music) Additionally, does anyone know about how to communicate w/ Cocoa Touch from this environment?
If you think this is not possible, which platforms are capable of this (other than the obj-c mac x-code route, which I am trying to avoid)?
Edit:
After a week, no answers at all. Very disappointing. I don't normally ask questions - this is my first! Isn't there anyone from Adobe here?
Having seen a project that I wrote being ported by someone else to work on iOS, using the iOS packager, I can say that it's totally possible that sounds playing in the AIR app can play even after you "close" the application whether you intend them to or not (continued playing in this case was not the desired situation). As long as the application exists somewhere, playing sounds appear not to stop without an explicit command otherwise.

iPhone, is it possible to play a sound from the speakers while in a call?

I would like to know from some iphone-Audio expert if there is a way to let a sound play through the line in of the microphone, or at least to play from the speaker (not the receiver) during a call.
I've tried different combinations of AVAudioSessionCategory with kAudioSessionProperty_OverrideAudioRoute, but I've noticed that when the iphone is in a call, it plays sounds only through the receiver.
My best try for the moment is to pick the call in speaker mode, and put the AVSession sound in AVAudioSessionCategoryAmbient, but the result is too bad.
I repeat: i would like to play a sounds through the speaker while listening the call through the receiver.
I've used this in: http://www.pallaudio.com , the app that lets you lie at the phone!
I'm curious as to what you're trying to achieve by doing so? Besides the fact that this could get your app rejected for non-standard behaviour (I'm sure Apple has some guidelines related to apps playing sounds during a call), this also seems like a sure-fire way to tick off a user (although maybe that's what you're trying to do).
Very simply. It does it by playing the sound during a call initiated by ANOTHER device.
Fooled me too for a minute there...same deal as another app, called "Escape Pod".
Check out http://theamazingaudioengine.com/
It does have the capability to do this. From a user point of view though, I know sometimes Apple will throw a complaint about running sounds through the main speaker while the receiver is enabled at the same time too. Hopefully though, as long as you're not just planning on running fart sounds through the speaker, you should be ok.
ok, after long finding, the answer is simply: NO!

Is it possible to programmatically mute the iPhone?

I've seen techniques to make sure that an app respects the mute switch, but is it possible to set the iPhone to mute (no sounds from any apps) using the SDK?
No.
Applications developed using the official SDK cannot change (and in most cases cannot even access) system-wide settings.
It is possible, but only using private API's. I only went as far as muting the ringer, but you should be able to control the master level as well.
See How to disable iOS System Sounds
It is technically possible to change the system volume through the private AVSystemController class in Celestial.framework, but will prevent your app from getting Apple's approval
As only one app can be running at a time, the only possible use I can think of for this would be to mute other people's apps, and it should be fairly clear why Apple prevents that.
What would I do if an app muted the iPhone and I didn't know it happened? It can't physically move the mute switch on the side of the phone, so that wouldn't match, and I'd have to figure out a) that the phone was muted and b) how to unmute it without the switch.
I can change volume using AVSystemController, it sets to minimum which is 0.06x. Is there class/API to mute it completely? toggleActiveCategoryMuted does not work