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.
Related
I'm developing a chat-app for iOS that must use an existing server API. The way it works is pretty straightforward: the app checks every given interval whether there are new messages on the server and displays them, plus, it sends the server new messages that the user typed.
When the user starts 'multi-tasking' or presses the home button, my app will go to the background and therefore will not be able to check the server for new messages. The server will automatically assume that the user stopped the chat when a certain timeout has been reached.
Often, the user isn't aware of the fact that when the app is put to the background, it is unable to maintain the connection to the server and will stop the chat. I'm looking for a method that will notify the user of this behavior as soon as the app is put to the background.
My current idea is to notify the user when applicationWillResignActive and/or applicationDidEnterBackground is fired, but I wouldn't know in what way. Can it be done in a way that complies with Apple's guidelines?
I'm aware of the fact that the best solution would be a different overall design of the software (e.g., using push notifications and no server-side chat termination by timeouts), but in this case I can't change that.
I would continue running in the background and set an expiration handler block (called by the os when you app is REALLY killed) and there schedule a UILocalNotification
use
- (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:(void (^)(void))handler
I'm making an iPhone app. I can receive UDP messages using AsyncUdpSocket. I want the app running in background, and when receive a message, an UIAlertView is displaying to the user, and he can enter in the app, or ignore the alert.
Is it possible to detect a message when the app is running in background.
Do I need something to execute my code in this method?
- (void)applicationDidEnterBackground:(UIApplication *)application {
}
I saw lot of tutorials, with timer, but I don't need timer to wake up my app. Also I read that's it's possible while playing music, tracking position or using VOIP.
Do I need to play a fake song to keep my app running? or to do something like that?
This app is for security, for example if someone is touching or moving your motorbike/computer/whatever else, your iPhone can alert you and prevents from stealing.
I read other threads similar but didn't find an answer.
Thank you guys for giving me tips, or any help /sample.
You can't run in the background on a non-jailbroken phone without being in one of those three categories of app, and Apple’s really unlikely to approve your app if you use that facility for another purpose. UDP probably isn’t the best solution for this anyway—if your phone leaves the network that the other device (whatever it is) is on, it won’t receive the notification at all, whether or not it’s in the foreground. You’re probably a lot better off using the push notification API.
This seems like a perfect case to use Apple Push Notifications (APN). You app can register to receive the notifications and the phone will alert the user with any combination of badging, messages, or sounds. Sounds like you already have a server that is sending the UDP messages, so incorporating APN should be minimal. Especially if you use a third-party to send the push notification, such as Urban Airship. (I am not affiliated with them, but have used them on a large commercial project.)
By definition, local events are not triggered by receiving a message.
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 have an app that I am working on, and part of its main functionality is to alert the user to do something. So even though they aren't in the app, I want to be able to pop up an alert from the app, reminding them to do something. Is that allowed with the iPhone sdk? Maybe it isn't even a big deal at all, but for some reason I was thinking that it would require background processes or something that may or may not be possible. Anyone who has any thoughts about how this would be implemented would be greatly appreciated. Thanks!
Check out the Apple documentation on push notifications. Short of jailbreaking and distributing your app outside the App Store, there is no way to run background processes at this time.
It is allowed through notifications, though you will need a server to actually send the notifications to the user. There is no limit to the number you can send, although the user may very well decide to shut off notifications or delete your app altogether if you are too spastic with them. Make very sure the user understands the notification volume they will receive and agrees to it...
The way the system works is the user gets a notification message (and/or sound) and can decide to open your app or not, as the time of notification.