I am new in iPhone programming. so please tell me Can we get the notification when the phone rings and answer the Phone? If Yes then How?anybody help me.
If an iOS app is in the foreground and has set an audio interrupt handler in the app's Audio Session setup, then that handler will get called when the phone rings. If the call is accepted, then the app will be notified that it is being sent to the background. If not, then the audio session handler will be called again to allow the app's audio to be restarted. If an app is not running in the foreground, or does not have an active audio session, it is not possible to get any notification.
Related
My app connects to a Bluetooth sensor then starts updating the UI based on the notifications sent from said device. I am having a problem with IOS automatically generating a large amount of notification pop-ups when the app is minimized, I think this is due to the frequency at which the sensor is sending data. So I am trying to figure out how to keep the user from being bombarded when they minimize the app. I am trying to tell the device to stop sending data, but I suspect that delegate method never gets called.
I have tried adding
[application cancelAllLocalNotifications]
to both
- (void)applicationDidEnterBackground:(UIApplication *)application
and
- (void)applicationWillResignActive:(UIApplication *)application
but still seem to have an issue, any ideas.
Thanks
You can use CBPerpheral::setNotifyValue:forCharacteristic: to start or stop getting notification from the said peripheral.
Another option is to use session backgrounding. For that you need to add the bluetooth-central backgrounding mode to the app's plist file. After that the app is going to receive the bluetooth communication events both in foreground and background and no notifications will be generated by iOS. If your app decides it needs a notfification, it can simply generate a local notification (tutorial).
I am at the beginning with RestKit-development. I develop an app that
get data from a Server and map these in objects. With a trick of
silence music, is it possible to send request to the backend, if the
app is in background mode . If I
leave the app the request will send, but the delegate of "finish with
objectmapping" will not throw, but if I start (activate the app) the
app, the delegates
will fire. Is there are a way, to map the json if the app is in
background mode?
I've provided an answer to your other post which I think will help you here. See link:
Your other post
Yes, if you configure your application to have a background mode that plays music and play audio while you want your application to continue to run. You can use a silent audio file if you don't actually want to play music so long as you don't want to distribute it through the App Store, but Apple will not approve it for the App Store unless there is actual music as an actual feature in your application.
I would like to send data to my app, when it is runs in the background. I know its possible to let the iphone do some background tasks, but is it also possible receive data from a server when the iPhone is in the background. So that when the iPhone receives this data, i can change the behaviour of the 'background' app.
I am also aware of push notification, but what i mean is that the user wont be notified.
No this is not possible, there are 3 background apps allowed by apple. Those are VOIP, audio and location based apps.
There is no other way to push data to an app other then push notifitcaions. but your app only receive the notification when the opens the notification.
The only other thing you can do is poll if the server has any new data for your app, but you can't really do this while in the background.
Is there a way to check if the phone is locked? Or do I receive a notification of the phone is going to be locked?
My app runs in the background, continues to play audio, so applicationWillResignActive: isn't really what I am looking for.
Checkout UIApplicationProtectedDataWillBecomeUnavailable. This appears to be called when the device is locked. iOS4 + only.
UIApplicationProtectedDataWillBecomeUnavailable
http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html
You can't, directly. Indirectly, you can watch for accelerometer on/off notifications.
Why do you want to detect this event in the first place?
When iPhone application go to applicationWillResignActive mode, I need to download the data from specific site continuously(Using Timer) and if any data receive from that site should push the UILocalNotification. But if App has enter into Background, Downloading functions is not calling. Exactly i want as Mail app.
You can't do that unless you're a VoIP app or a GPS app.
For other types of app, the closest you can do is request the 10 minute long task completion mode. That'll give you ten minutes of running whatever you want in the background, after which the system kills your app.