Can an iphone app process audio input while the phone is in sleep mode - iphone

I need to build an app that can take in a user audio input and process it even if the phone is in sleep mode. For example, if a user says "Hello", then app needs to recognize that and process it even if the phone is in sleep mode. I have read posts that explain how to prevent a phone from going into sleep mode and that would be my second option if the app cannot read the audio input while the phone is in sleep mode.

I'm afraid that's not possible, there are 5 different types of apps that can keep on running on the background, these are (from the Apple documentation):
Apps that play audible content to the user while in the background, such as a music player app
Apps that keep users informed of their location at all times, such as a navigation app
Apps that support Voice over Internet Protocol (VoIP)
Newsstand apps that need to download and process new content
Apps that receive regular updates from external accessories
if your app is not doing any of these, your app will not execute code when it goes onto the background. Also, you should declare that your app is performing one of these functions before sending it to Apple for review.

Related

when my iphone receiving calls, and my app is in background, i want call some codes (alert coreblue4.0 device)

I have used ctcallcenter, and use beginBackgroundTaskWithExpirationHandler, so I have only 10 minutes to call my codes. How can I make it longer,the app proxBLE have achieved it?
From the Apple documentation, you can extend the execution time only in the below cases. In order to do that, you need to add the UIBackgroundModes key to info.plist file. See the detailed explanation below.
Implementing Long-Running Background Tasks
For tasks that require more execution time to implement, you must request specific permissions to run them in the background without their being suspended. In iOS, only specific app types are allowed to run in the background:
Apps that play audible content to the user while in the background,
such as a music player app
Apps that keep users informed of their
location at all times, such as a navigation app
Apps that support
Voice over Internet Protocol (VoIP)
Newsstand apps that need to
download and process new content
Apps that receive regular updates
from external accessories
Apps that implement these services must declare the services they support and use system frameworks to implement the relevant aspects of those services. Declaring the services lets the system know which services you use, but in some cases it is the system frameworks that actually prevent your application from being suspended.
Declaring Your App’s Supported Background Tasks
Support for some types of background execution must be declared in advance by the app that uses them. An app declares support for a service using its Info.plist file. Add the UIBackgroundModes key to your Info.plist file and set its value to an array containing one or more of the following strings:
audio—The app plays audible content to the user while in the background. (This content includes streaming audio or video content using AirPlay.)
location—The app keeps users informed of their location, even while it is running in the background.
voip—The app provides the ability for the user to make phone calls using an Internet connection.
newsstand-content—The app is a Newsstand app that downloads and processes magazine or newspaper content in the background.
external-accessory—The app works with a hardware accessory that needs to deliver updates on a regular schedule through the External Accessory framework.
bluetooth-central—The app works with a Bluetooth accessory that needs to deliver updates on a regular schedule through the Core Bluetooth framework.
bluetooth-peripheral—The app supports Bluetooth communication in peripheral mode through the Core Bluetooth framework.
Each of the preceding values lets the system know that your app should be woken up at appropriate times to respond to relevant events. For example, an app that begins playing music and then moves to the background still needs execution time to fill the audio output buffers. Including the audio key tells the system frameworks that they should continue playing and make the necessary callbacks to the app at appropriate intervals. If the app does not include this key, any audio being played by the app stops when the app moves to the background.

How iPhone application WeatherTunes realized running in the background [duplicate]

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
How To Switch music from my app to the ipod
There is an iPhone application named WeatherTunes (天气旋律闹钟 in Chinese) in iPhone AppStor, search with key words "WeatherTunes " e, it appears at the first.
You can add alarm in WeatherTunes, even if you switch this application to background, it still runs. I look into its info.plist file, I noticed it set the "required background modes" with value "App plays audio". But I still can't figure out how it can be run in background? Thanks for any help.
Apps can run in the background if they have any of the 5 requirements:
Apps that play audio while in the Background state. A good example is Instacast while it’s playing a podcast.
Apps that track your location in the background. For example, you still want voice prompts from your turn-by-turn GPS navigation app, even if another app is Active.
Apps that listen for incoming voice-over-IP (VOIP) calls. If you use Skype on iOS, you can receive incoming Skype calls while the app is in the background.
Newsstand apps that are downloading new content.
Apps that receive continuous updates from an external accessory in the background.
It may be possible that this app is playing a silent audio file in the background, a tactic that I have seen before, but generally that will be rejected from the apple store.

LocalPushNotification in iphone

When iPhone application go to applicationWillResignActive mode, I need to download the data from specific site continuously(Using Timer) and if any data receive from that site should push the UILocalNotification. But if App has enter into Background, Downloading functions is not calling. Exactly i want as Mail app.
You can't do that unless you're a VoIP app or a GPS app.
For other types of app, the closest you can do is request the 10 minute long task completion mode. That'll give you ten minutes of running whatever you want in the background, after which the system kills your app.

iPhone Dev: Can you have a program running in background respond to SMS in iOS4+?

Can you have a program running in background respond to SMS? I basically want my program to sit in the background so the will be iOS4+ and when someone text messages you, the app can then do something with that text.
Can this be done?
I have seen that the question has been asked before, but it was before the iphone could have background apps.
No backgrounding is very limited on IOS. There is only a handful of stuff you can do. You can always send push notifications to get an alert while the app is not running in the foreground.
From Apple:
OS 4 delivers seven new multitasking services that allow your apps to
perform tasks in the background while
preserving battery life and
performance. These multitasking
services include:
Background audio - Allows your app to
play audio continuously. So customers
can listen to your app while they surf
the web, play games, and more. Voice
over IP - Your VoIP apps can now be
even better. Users can now receive
VoIP calls and have conversations
while using another app. Your users
can even receive calls when their
phones are locked in their pocket.
Background location - Navigation apps
can now continue to guide users who
are listening to their iPods, or using
other apps. iOS 4 also provides a new
and battery-efficient way to monitor
location when users move between cell
towers. This is a great way for your
social networking apps to keep track
of users and their friends' locations.
Push notifications - Receive alerts
from your remote servers even when
your app isn't running.
Local notifications - Your app can now
alert users of scheduled events and
alarms in the background, no servers
required.
Task finishing - If your app is in
mid-task when your customer leaves it,
the app can now keep running to finish
the task.
Fast app switching - All developers
should take advantage of fast app
switching, which allows users to leave
your app and come right back to where
they were when they left - no more
having to reload the app.
Nope. The only way for your application to be "called" when it's not already open is by sending a push notification.

iphone is it possible to register my application so the os notifies it every X seconds?

Hello I would like to know if there is an equivalent to the android's alarmManager so I can register my app to be waken every X seconds?
No. At least not directly Here's the list of all kinds of multitasking that Apple supports from its's What's new page:
Multitasking
iOS 4 delivers seven new multitasking
services that allow your apps to
perform tasks in the background while
preserving battery life and
performance. These multitasking
services include:
Background audio - Allows your app to play audio continuously. So
customers can listen to your app while
they surf the web, play games, and
more.
Voice over IP - Your VoIP apps can now be even better. Users can now
receive VoIP calls and have
conversations while using another app.
Your users can even receive calls when
their phones are locked in their
pocket.
Background location - Navigation apps can now continue to guide users
who are listening to their iPods, or
using other apps. iOS 4 also provides
a new and battery-efficient way to
monitor location when users move
between cell towers. This is a great
way for your social networking apps to
keep track of users and their friends'
locations.
Push notifications - Receive alerts from your remote servers even when
your app isn't running.
Local notifications - Your app can now alert users of scheduled events
and alarms in the background, no
servers required.
Task finishing - If your app is in mid-task when your customer leaves it,
the app can now keep running to finish
the task.
Fast app switching - All developers should take advantage of fast app
switching, which allows users to leave
your app and come right back to where
they were when they left - no more
having to reload the app.
Adding to Georg's answer, you probably want this:
Local notifications - Your app can now alert users of scheduled events and alarms in the background, no servers required.
Unfortunately it also requires the user to okay relaunching the app to run your code.