Can an iPhone app block phone calls? - iphone

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).

Related

How to block incoming phone calls, text messages and email in Objective C

Is there any way to block incoming phone calls, text messages and email. Will appstore allows these kind of applications on appstore. Please help me if this is possible or not.
It is now possible from iOS 10 to block the unwanted calls
Checkout the CallKit framework
CallKit 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.
Update: Never say never :) iOS 10 introduced this possiblity, see other answers.
Original:
NO, this is not possible with public API (and non-jailbroken devices)
And NO, Apple would never allow any app that disrupts the expected standard system behavior
Apple will never allow any third party application to do any illegal things without user's knowledge. This is the policy I think apple has applied to ensure his user's that their data are safe in their iphone. U can consider mails, calls, sms to be under those categories. There may be others which I might have missed.
Please refer this link for your knowledge
Only Apple can do that and unfortunately for you they plan to do otherwise.. :/
Even if it is called "smart", all in all your target device is a "phone" so the basic phone functionalities should not be ever blocked, and the phone manufacturers do not allow this for third party applications.
Rajan is correct you can block the incoming phone calls from iOS 10.
Create a Call Directory Extension , use the addBlockingEntry(withNextSequentialPhoneNumber:) method to pass the blocked numbers to the system.
Now it's end of 2018 and actually you can really do something with Apple's latest API.
As #Rajan stated, with CallKit API (iOS 10+) you can achieve call blocking and identification (i.e. show additional info on the incoming call screen for the caller's phone number).
You can also do SMS and Call Reporting (iOS 11+) as well, where you have access to the SMS content if the number is not in your Contacts.

Does Apple approve the usage of setKeepAliveTimeout:handler methode for updating GPS location to server?

I'm writing an application that needs once in a while to update the server about the user's location while the application is running in the background. I know I can do this by using the setKeepAliveTimeout:handler: method. I know that this method is specially for VoIP application but I was wondering if Apple will allow this usage for location update to server?
The documentation says that your handler only get 10 seconds to keep the network connection alive for voip calls when using setKeepAliveTimeout:handler: method. See this answer.
This call is for voip apps and you must have voip in your UIBackgroundModes key (info.plist). Using this would probably get rejected unless you are writing a voip app.
You don't need this setKeepAliveTimeout.
I recommend to read this Apple's officatin documentation:
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html
One of the things, which iOS provide is a callback on a location change. Your application will be awoken for short period of time and you will receive this callback and should be able to send your location to the server.
BTW. You will need location backgrounding mode for this.
And progmr is right. You will need voip backgrounding mode to use setKeepAliveTimeout. And if your application isn't a real voip application, almost guaranteed that your app will be rejected.

Programmatically initiate Conference call on IPhone

Is there a way to make a conference call programmatically on the IPhone ?
I want to be able to place a call to persons A and B, connecting both, and then dropping myself and let the two parties continue the conversation.
Is that possible ?
Not possible. An app can place a call to a single phone number, via the -openURL: method on UIApplication, but once it does that, it goes into the background and the Phone app takes over.
Also, it sounds as if you’re trying to make a prank-calling app, which is in violation of section 22.6 of the App Store Review Guidelines:
Apps that enable anonymous or prank phone calls or SMS/MMS messaging will be rejected
That type of calling you described in your question, can only happen if you are on a phone system (PBX) in a office. On a mobile phone or the phone in your house, once the party that initiated both calls hangs up, everyone is disconnected.
It's not possible with Facetime if you aren't one of the two persons. But, you would a audio conference or a video conference ?

possible for an iPhone app to make the iPhone "go dark" for a specified number of minutes?

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.

iPhone answering machine

Is it possible to create an iPhone application to answer incoming voice calls and play audio files back to the caller? If yes, before answering the call, is it possible to determine the caller id?
Thanks!
This is not possible using the SDK. You can most likely do it with a jailbroken app.
iPhone applications (non-jailbreak apps, at least) cannot intercept phone calls. When a phone call is initiated, your app is paused and cannot execute any commands.
Essentially, count on never being able to prevent basic functionality of the iPhone. You can't override texting behaviour, Mail.app behaviour, Safari behavior, etc. because Apple wants the user experience to be consistent (not to mention security issues in allowing an app to answer calls on someone's behalf).