How to hang up a call automatically? - ios

I'm very interesting to know how to hang up a call automatically. If I push my call button
(this is it's code):
-(IBAction)callPhone:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phone.text]];
}
I want to hang up the call after 5 seconds automatically. How can I do that?.
Thanks.

That is outside the scope of the iOS SDK. You can't tell the phone subsystem to do anything. This merely invokes the system to do something.

you can't, you can initiate call from your app but you can't hang up.

Related

phone call failure or disconnected call backs while making a phone call

On a button click I am making a call inside my app by using the following code
NSString *phoneNumber =#"telprompt://123-4567-890";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
I want to do some working if the call is failed or disconnected (might be due to low balance or network signal problem). Is there any delegate for call disconnect or failure for doing this? Any help will be appreciated.
No, once you have handed over functionality to the telephone app your app is then put in the background and will only be activated once the user goes back to it manually.

Objective-c make phone call in background mode

I have to solve the following problem in objective-c:
Application in background
For an event, i need to call a specific phone number on the iPhone while it is still in background
As i see my logs, the phone call method will be called, but the phone number not dialing by the iOS.
Here is the action method:
//------------------------------------------------//
- (IBAction)actionCall:(id)sender
{
id<ICallModel> _AutoCall = [self retrieveAutoCall];
if(_AutoCall != nil)
{
DDLogDebug(#"RESCUE CALL: %#",_AutoCall.PhoneNumber);
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"tel:%#",_AutoCall.PhoneNumber]]];
}
[self actionCancel:nil];
}
//------------------------------------------------//
If the application is active, then it works perfectly.
I've added the proper background modes too.
Is it possible some way to achieve this flow?
Thanks,
Tom
Apple doesn't allow you to start calls if your app is running in the background.
What you could do is using Local Notifications to make the user returning to your app.
Once your app is back in the foreground it could start the call.

How can I programmatically deactivate application?

I'm creating a jailbreak tweak that includes calling from the lockscreen. I am currently using [[%c(SKTelephonyController) sharedInstance] dialNumber:number] to call a number.
Everything is working fine and the call goes through until you try to make a call when there is an open application. For example, if you leave an application open and lock the phone without closing the application, SpringBoard will crash when you try making the call. If there is no open application, the call works fine and there is no crash.
Is there a way to suspend the application programmatically?
I've already looked into [[%c(UIApplication) sharedApplication] _killThermallyActiveApplication];, but the selector is unrecognized, although it is found in the private headers. I've also tried [application disableContextHostingForRequester:#"LaunchSuspend"], which also isn't working.
I'm trying to deactivate the application before making the phone call, but after 2 days of searching through headers, I am unable to do so.
Any help is appreciated.
Finally figured it out! I'll put the code below for those who need it.
[[%c(UIApplication) sharedApplication] quitTopApplication:nil];

Return the user to my application after making a phone call

I want the user to be able to call a phone number form within my app. Is it possible for the user to be returned straight back to the application after finishing the call?
1: I guess that this is the default behavior, isn't it?
2: you can check if the device can open the tel:// protocol:
BOOL canCall = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"tel://"]];
I know this is an old question but this can be done using:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"telprompt://111222333"]];
I believe this can be done for iOS >= 5.0.
The behaviour of telprompt:// is slightly different than tel://.
1
It depends how you initiate the call.
You can chose between:
Present a pop-up in which the user has to approve the call. Your app will be launched afterwards again.
Directly call, without showing a pop-up first. Your app wont be launched after the call.
for how to implement both ways, please read this question: iOS 4.2 - Return to app after phone call
2
Check if the device can open tel: URLs with the following code:
BOOL isPhone = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"tel:123456789"]];

How can I do a call in ios?

I need to do a call in background to a number and, if is possible, to enter a code during the call. Can I do this?
This call must be done via user's phone!
in background? No. You can always use
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:#"tel:1234567890"]];
to make a call, but it will open the Phone app

Resources