I would like a local notification to be fired when a call is received (and to show an alert) - is this possible? Can a call event get an app to launch or a notification to be fired?
How is skype fired? With push notifications?
Thanks
Your application delegate will receive calls to various UIApplicationDelegate protocol methods when various events happen. One of these is the - (void)applicationWillResignActive:(UIApplication *)application method, which is called for incoming calls or text messages, but could be called for other reasons as well.
See the UIApplicationDelegate protocol reference for more information.
If your application is running while a call is in place check out the CoreTelephony Framework. The CTCall class provides information about the call state. I have not used this myself but you may find it useful.
extern NSString const *CTCallStateDialing;
extern NSString const *CTCallStateIncoming;
extern NSString const *CTCallStateConnected;
extern NSString const *CTCallStateDisconnected;
Edit:
The CTCallCenter allows you to register for call event state changes. As I said before your application will need to be running to know that something has changed. You may want to request the maximum backgrounding time (I think it is 10 minutes now) when your application is moved to the background. These api's are only available in iOS 4.0 and later.
And, to answer the part of your question nobody's touched yet, Skype is using backgrounding methods specifically meant to keep an app alive in the background to receive VOIP calls. A little bit of it is actually running, waiting to be called. Unless you claim to be a backgrounding app for VOIP or audio purposes, you can't do that--and if you DO claim that, you better be DOING it, or you'll never hit the app store.
The best you can do is hook the applicationWillResignActive method, which gets called basically whenever your app loses focus (which happens when a call comes in, but also happens for other reasons, so it's not perfect).
See: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html
Related
I am trying to make an app, which should come into picture (each & every time) as soon as the user is done with his/her phone call.
Use case:
"My app" is currently not running.
User Makes a phone call from mobile.
Once the call is completed, "My app" should start/running.
It should gather some information about last call.
write it into log & ends..
I have seen tasks running in background foreground but how to invoke App after each phone call.
Thanks..
You cannot do this. Quite simply iOS does not (yet) have any such feature where your app would be triggered based on some system event.
But you can explore some alternatives when a call comes when your app is running.
If your app is running when the call comes
It might be possible to sign up to receive notifications (using UINotificationCenter calls) from UITelephony.
However, if you're actively using your app when the phone call starts, it will call -(void)applicationWillEnterForeground when the call is finished. As for differentiating a phone call end versus just a regular return to phone call, I don't know. But it's a start.
If your application is running while a call is in place CoreTelephony Framework provides call states. CTCall class provides information about the call states. I have not used this myself but you may find it useful.
extern NSString const *CTCallStateDialing;
extern NSString const *CTCallStateIncoming;
extern NSString const *CTCallStateConnected;
extern NSString const *CTCallStateDisconnected;
No, its not possible to fetch Call/SMS/Email logs in iOS 5 and later.
You can do this in jailbroke
any ways if you are trying to achieve this in iOS 4, I have a useful information HERE
It is not possible in iOS till now if the device is not jailbroken.
iOS doesn't allows any app to intercept working of any other application.
I need to detect the state of a call in an iPhone app, when my app is in the background. I need to do something when the state of the call is outgoing.
Is this possible? If this is possible how can I do it?
This is not really possible. CTCallCenter gives some info in the state of a call but you'll only get those notifications when your app is active.
Check out CTCallCenter Class Reference and CTCall Class Reference. The available states are defined as:
CTCallCenter
callEventHandler
CTCall
callState
Cellular Call States
CTCallStateDialing
CTCallStateIncoming
CTCallStateConnected
CTCallStateDisconnected
I'm developing for a jailbroken device, and I want to create an app that detects a phone call, and presents an alert on top of the call screen. How can I achieve this? What hidden frameworks should I use?
Within CoreTelephony is the CTCallCenter class which includes the callEventHandler property, which is a block that runs upon changes in the call state. As described in the documentation, you could use this to become notified of these states:
CTCallStateDialing;
CTCallStateIncoming;
CTCallStateConnected;
CTCallStateDisconnected;
Docs say you must be in active app state. If you are suspended, then you only get one block state change notification upon waking up. If you are jailbroken and in background state, hopefully you would get your block executed, so you could become aware of this.
This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
how can i terminate api call in iphone
hi friends,
I have an api call in my iphone app. That api call take more time for loading (near 100 sec). while the api processing, i hit the home button of my app. the app terminated. but the api call doesn't terminated.
how can I terminate api call.
Like e.James said, look at the UIApplicationDelegate protocol.
However, you might be more interested in either applicationDidEnterBackground: or
applicationWillTerminate: (depending on whether or not the device supports multitasking), because applicationWillResignActive: will also be called in cases like when the user receives a phone call, or other similar interruptions (see documentation).
Check out the UIApplicationDelegate protocol. You can cancel the API call in the applicationWillResignActive: method, which is called just before the app goes into background mode.
Seeing you duped the question, i'll post my answer here too:
I suppose you mean a web API call, like google's geoservices. To do this, you will need to make the call using a NSURLConnection. This way, you can cancel a call anytime using [connection cancel].
Try this tutorial. It's meant for a JSON api call. If you need another API, just start reading from 'fetching JSON over HTTP', there they set up a NSURLConnection. If you retain this connection until it's done, you will be able to make the [connection cancel] call at anytime.
Using the UIApplicationDelegate, you can detect the app entering the background.
How can I check missed call in iPhone using Objective-C?
There is no access to the iPhone phone from third party software. Luckily.
The sandbox prevents access to the phone functions from third-party apps. Thus there is no way to detect missed calls.
Using Core Telephony framework, detect for call state changes.
Listen for incoming calls. Now your application will be notified when there is an incoming call.
After this, when the alert pops up, applicationWillResignActive is called.
If the user accepts the call, applicationDidEnterBackground is called, and then when user switches back to your application applicationDidBecomeActive will be called.
If the user rejects the call or the calling person ends the call before accept/reject, applicationDidBecomeActive will be called.
The second case indicates a missed call.
When you have an incoming call, the function
- (void)applicationWillResignActive:(UIApplication *)application;
is called and if the call gets missed, the application will be active again and the function
- (void)applicationDidBecomeActive:(UIApplication *)application;
is called.
This way, you can detect missed calls. There is no other method to do this that i am aware of.
The only drawback is that these methods are also called when you Lock/Unlock the device when your application is active so you will not be able to know whether it was a missed call or the user locked the device.