Volume Hardware Button Input - iphone

I have asked this question before, but have not received any real answer. How do iPhone developers, such as the developer of the Camera+ app, detect when the volume buttons are pressed and how do they prevent the system volume change. Please do not just link to an old answer unless it uses a way that is currently App Store safe. If anyone knows, help is greatly appreciated. Thank you!

There is no App Store safe way to do it except to use the framework camera controls. When you use the standard controls, you get the volume controls for free. The reviewer may or may not let you go if you do it some other way, but officially you will be rejected unless you use the standard framework camera controls.

First off, becareful how you handle Hardware inputs, as you know if handle them incorrectly, you will get rejected from the app store
Secondly, read and learn Audio Session Programmming Guide this will help you understand how to handle hardware inputs, also here is the Audio Session Services Reference that will help you when it comes to programming the the listeners.
I can't give you code specific solution because you didnt elaborate where and when this is going to be used (in your app). Also where you handle the listener is up to you, so i have to leave it to you to figure out where to put your listener.
But a good resource is the apple developer library

Related

How to get signal strength from iphone and to publish the app in the App Store?

Is there any way to get the quality of the signal from an iphone? I know that i can get this data from CoreTelephony framework, but it is an private framework and Not permitted such frameworks in the app store.
Someone can help me?
Thanks for all.
Best regards
You cannot currently get access to this information via a public api. Apple provides some sample code for checking if there is an internet connection and if the device is on wifi/cellular amongst other things. This is available at:
https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html
You could also try something really hacky like taking a screenshot and doing some image analysis on the top left corner of the screen to determine how many bars there are, if you're really keen..?

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

Where from could I download iPhone system sound files

I need to play in my app iPhone system sound files, for example, message sent, message received.
I was expecting to find these sound files available by default in iOS, but it seems not, please, correct me if I'm wrong.
Is there is away to download these default system iPhone sound. I need mainly message sent, message received.
To add to what WrightCS said, Apple makes it very clear that the only media assets (sounds and pictures) you are allowed to use are the ones that they provide explicitly. If you try to use their sounds they will definitely reject your app.
They also don't want you using their media for anything other than the things they intend them for. Their Human Interface people would have whole litters of kittens if they found out somebody was repurposing their carefully chosen UI elements for other uses, and would reject your app with extreme prejudice.
In short, don't do it. It will get you rejected.
To use sounds in your app, you will either need to create these sounds yourself, or purchase sound effects from a number of different websites. Being that your application is sandboxed, you cannot access the SMS send / receive sounds (for example). I also doubt Apple will allow you to "steal" their sounds for use inside your application. Try searching for free sound effects, One Example.
Theses resources should help you get started.
https://github.com/TUNER88/iOSSystemSoundsLibrary
https://developer.apple.com/library/ios/documentation/AudioToolbox/Reference/SystemSoundServicesReference/Reference/reference.html

Can I send locations to a server in background on Iphone?

I'm looking for the answer to my question but it's quite difficult for me. I would like to keep connected to the server in background sending location of the iphone with ios4.
I`m really sad because I think that multitasking of apple is not real multitasking, in fact they only keep the state of the app but they don't allow it to run in background.
May be somebody knows if is possible to send a call by http every 30 or 60 minutes...
Please, any help would be very appreciated. Thanks in advance
Depends on it you are looking to track the user -- like Grindr does (this is not bad, per se, it just must be disclosed to the user -- and PLEASE remember to power down the GPS equipment if you really do not need to do this at certain times).
You are able to register for several different types of "location" registrations, wake up (enough to do something with that information) and wait until the next update.
Look at Multitasking under "Receiving Location Events in the Background". It will give you all the info you need. Short answer: iOS4 may not support what you think you need for this, but it, in fact, does support everything required to do what you are asking.
link text (Membership required)
I know this is an old question, but below is a relevant statement from the Core Location documentation regarding background handling of "significant location change":
Because your application is in the
background, it should do minimal work
and avoid any tasks (such as querying
the network) that might prevent it
from returning before the allocated
time expires. If it does not, your
application may be terminated.
link to documentation containing quote
I'm not sure if the quoted statement is saying to avoid all network "queries", but I think a quick POST of the location should be fine.
I did this but my app got rejected due to this last week. I used the ios5 SDK.
There's a good answer to this question by user RedBlueThing here.
The answer is basically yes, you can process network requests, but you might need to ask the OS for more time to accomplish the task.

acessing to iphone camera data only with API

I would like to access in real time to the data of the camera to get the hue of several points in order to guide the user (inform him when is the best moment to take the picture).
The application will be probably available on the appstore and then I want to just use allowed API. I've seen a lot of similar topics, some of them telling this is possible but none of them showing a solution.
Do you have any idea for this?
Thanks in advance :)
You need the undocumented UIGetScreenImage() function; an Apple representative recently stated their approval of the use thereof in the iPhone developer forums.