How to identify while getting incoming call in iPhone app? - iphone

I am editing some thing in an iPhone editor application. That time, I am getting a call. How can I identify an incoming call by coding ?
If any one having idea about this, just share with us.

You can't. This is actually a FAQ already :-) All you can do is implement the applicationWillResignActive method in your application delegate (or listen to the corresponding notification). However, you also get this event when some alerts are shown or when the screen gets locked and you can't distinguish why you are getting the event.

Take a look at following URL
Could be helpful for you
Core Telephony

Related

How to keep user notified that application is running in background?

Since few days i am searching for the functionality which will allow me keep user posted that application is running in background. I have attached a !image for what exactly i am looking for. i tried googling but could not get exactly what I need. when i tap on the flashing red bar it takes me back to the application.
Thanks in advance.
The red banner you pictured is provided by the system, is shown only if your application uses background audio recording (see AVAudioSession), and doesn't provide the opportunity for you to choose what happens when the user taps it.
Unless your app fits into one of a few specific classes, it doesn't actually "run" while in the background. Instead, it's "suspended" -- still in memory, but gets no CPU time. What happens outside of your app is thus up to the system, not to you... the only way to show a banner that will launch your application is to use a push notification service or UILocalNotification, but those banners are only shown briefly, and you don't get to control their duration. What you seem to be specifically asking for isn't possible using public API.
The kind of notification you want isn't supported by the current iOS for third-party developers.
If you want that kind of functionality then implement Apple Push Notification service through
this you can first give message to Apple push notification service. then Apple service
automatically generate notification for your App as you want.

Incoming call wakes iOS background App?

is it possible to wake an App in the background up, when a call comes in, and access CoreTelephony to send some infos over the web?
I'm practically a n00b in iOS development right now, but got asked a question if iOS is capable to do this. I searched in the iOS reference too, but with no luck.
It would be great if someone with more experience could answer it. Thanks a lot!
Steno
Please, have a look at the document about executing code in the background.
If you go to section "Implementing a VoIP Application", you will see that it is actually possible for your app to be awaken periodically so that it can check if it has anything to do (in your case, if I understand you correctly you would use CTCall to check for calling state).
So, basically, when awaken, your app could check for any incoming call and then use Core Telephony, as you say.
The only trouble about this is that if your app cannot be considered to a a VOIP app, Apple will not let it into the App Store.
It is not possible to have your code run when a call is received.

How to detect what triggered applicationWillResignActive?

I have a Video Chat application that I want to disconnect from a call when the device is locked, but stay connected when an SMS, calendar, low battery or any other type of notification is received. The problem is, I cannot figure out for the life of me how to determine what causes my app delegate's applicationWillResignActive selector to be called.
I have thought about implementing some kind of timeout where if applicationDidBecomeActive was not called within a certain number of seconds I would disconnect but that falsely assumes that a user will ignore or accept a received notification within that number of seconds.
Can anyone help me figure out a way to determine what caused the applicationWillResignActive selector to be called?
Many Thanks,
Mason
I think the short answer may be, that you can't really determine specifically what causes the resign call, however you can only plan according to if it actually goes in the background or not.
Check this link out where it details the steps multitasking takes.
http://www.cocoanetics.com/2010/07/understanding-ios-4-backgrounding-and-delegate-messaging/
Good luck, you seem like an awesome guy!
In my case I was stopping the video capturing on NSNotification.Name.UIApplicationWillResignActive
Now, I'm using the:
NSNotification.Name.UIApplicationDidEnterBackground
It isn't triggered when a message comes, or in case someone is calling to the capturing device.

Is there a concrete check to see if a user has accepted a phone call?

I know when a call is accepted applicationWillResignActive and applicationWillEnterBackground both get called. But they seem to also get called for some other cases.
Is there a way to check if the user has ANSWERED the incoming phone call rather than decline or let it ring out.
As there maybe cases when the app gets a phone call while the app is already in the background and I need to be able to get some code to execute.(Hope I havent been to vague)
Many Thanks,
-Code
Check out the Core Telephony framework, and the CTCallCenter object. I think it does what you're asking for...
https://developer.apple.com/library/ios/#documentation/NetworkingInternet/Reference/CTCallCenter/Reference/Reference.html%23//apple_ref/doc/uid/TP40009604

Iphone App - Is it possible to use text from an app?

Hey, I am about to start working on an app. I am a beginner, so I am starting out with a pretty basic concept. But, I was wondering if it was possible to send texts from an app. For example, if the person using my app sets a new high score, could they hit a publish button and my app could then send a text to his buddy bragging about the new high score.
Also, what if someone is using my app and they receive a text, does the OS take over, or do I have to handle the reception of text/calls. Is it possible to alter the way the phone behaves when my app is disrupted by calls/texts.
Thanks for any advice you can give. Have a good Monday everyone!
Apple's iOS documentation has a section that roughly covers how to incorporate in-app SMS.
Basically, your application displays an MFMessageComposeViewController as a modal view controller. It won't cause your app to terminate or background — it just lets your user send a text message, and when done, return to your app and continue.
When a phone call, text message or another notification comes in, your application delegate's applicationWillResignActive: method is called. It's up to you what you want your app to do while the user is dealing with the call, message or notification. If the call is declined or the alert dismissed, your application delegate's applicationDidBecomeActive: method is called and your application can resume as if nothing happened. Otherwise, the app either exits or backgrounds (depending on whether you want it to support multitasking), and you'll also have to handle it from there.
Also bear in mind what Toastor says about
Controlling whether messages can display to your user or not
Bills related to texting plans
There is no way to change the way the phone responds to calls. The only way to prevent your app from being interrupted by an incoming call is by activating the airplane mode on the device - which you cannot enforce from within the app.
Same goes for incoming texts - there is no way to notify your app if a message has been received. How would the system know if the message is meant for your app anyway?
The only thing you can actually do is send a text message from within your app. But if I were you I'd go either with established leaderboards or the new GameKit (have not checked this out yet myself, though).
Or, at least, use mail instead of text messages, since texts are not free in every country.