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.
Related
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
We want to build an application that the user can interact with while taking a phone call. The idea is that the user can do voice communication using the phone application of the iPhone and at the same time use our application to type and send additional data that is relevant to the call such as an e-mail address. This is the scenario:
User get's a call on the iPhone
The user clicks a button on our app to answer the call and let the phone application on the iPhone handle the phone call in the background.
Our application continues to run in the foreground so that the user can interact with our application to type and send data such as an e-mail address that is relevant to the call.
Is there a way for our application to answer an incoming phone call and let the phone application of the iPhone handle the call in the background while our application continues to run in the foreground?
Thanks,
Prasanna
Currently, the iOS SDK does not support redirecting incoming calls from the system to a custom application. There is only support for initiating a call.
This is not possible with the iPhone SDK.
You could possibly do this if you created your own calling (for example, like Skype does) but I'd say you're barking up the wrong iTree here. It is however possible on jail-broken devices using the custom toolchain but I wouldn't want to recommend that path for development!
You have no control over the phone call process on an iPhone (this is assuming that you’re not talking about a jailbroken iPhone). When the user receives a call, the iPhone presents a window with the number and the “Answer” and “Ignore” buttons (or, if the phone is locked or asleep, the “Slide to Answer” bar). To return to your or any other application, the user must press the home button, sending the call to the background (and activating the red in-call status bar).
The closest you’ll get to this scenario is the user manually running the application while on the phone. But then, if all they’re doing is writing notes, they could just use the Notes app.
Can an iPhone app be made to stop all calls and text messages for a specified number of minutes, that is, prevent the user from making or getting calls and messages? Can an app turn the device off temporarily? Context: help kids to concentrate while doing their homework/studying and not be interrupted with calls and text-messages from their schoolmates.
Not if you want to get into the App Store or run on non-jailbroken devices, no. One of the guiding principles of the SDK is that you can't "break" core functionality like inbound phone calls or SMSs. You will get notified that your app is about to enter a background state (or terminate), but you can't stop the user taking the call or terminating your app.
For information in events that you do get, have a look at UIApplication and UIApplicationDelegate.
I've heard it mentioned elsewhere, one cannot programmatically hook into the phone call area of an iPhone using the current SDK. I'm looking to learn iPhone development and Obj C, with the end goal of creating a call timer app that runs in the background and alerts the user when a call has gone on too long.
Is it even possible to hook into methods liek that?
No. Your app will be interrupted when the user receives a call, and your code will not be allowed to run while the user is on the call. Additionally, there are no background apps allowed for the iphone. The best you can get is push notification, but you can't create a daemon or anything like that.
This information is provided in the iPhone Application Programming Guide
With version 4 you can now multitask to some degree.
Is it possible to write an application that will block incoming and outcoming phone calls? Or is the iPhone locked down too much? Thanks!
EDIT: See Rajan Maheshwari's answer below. CallKit now provides this. Even things that seemed they would never change, can change eventually.
Anything that modifies a user's ability to make or receive phone calls is going to run afoul of Apple's basic approach to third-party apps. There are a lot of things that are questionable and you might get away with. Blocking calls is clearly forbidden.
It is now possible to detect and block unwanted phone calls from iOS 10 and above.
See the CallKit framework
The CallKit framework (CallKit.framework) lets VoIP apps integrate with the iPhone UI and give users a great experience. Use this framework to let users view and answer incoming VoIP calls on the lock screen and manage contacts from VoIP calls in the Phone app’s Favorites and Recents views.
CallKit also introduces app extensions that enable call blocking and caller identification. You can create an app extension that can associate a phone number with a name or tell the system when a number should be blocked.
A number of events will potentially interrupt an application - incoming call, SMS message or calendar alert. If the user ignores the interruption your application will continue running. If not, it will terminate.
See Apple docs for more details.
It is possible in iOS 10.
Here's how to do it ->
1.Create a call directory extension
2.Block the incoming call ->
class CustomCallDirectoryProvider: CXCallDirectoryProvider {
override func beginRequest(with context: CXCallDirectoryExtensionContext) {
let blockedPhoneNumbers: [CXCallDirectoryPhoneNumber] = [ phone Numbers here with country code! ]
for phoneNumber in blockedPhoneNumbers.sorted(by: <) {
context.addBlockingEntry(withNextSequentialPhoneNumber: phoneNumber)
}
context.completeRequest()
}
}
Note:
If you are using callKit to receive incoming calls then there is no need to manually block other calls.
Link -> https://developer.apple.com/reference/callkit
An app has not access to the phone feature, and has no way to block a call.
The alternative is to wait for Apple to offer that feature in the future.
In the meantime, you can
Ask your provider - some providers do that
Create a custom ring tone (silent) to be associated to some number (no ring).