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

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.

Related

How to specify that app must perform important tasks in the background?

I'm making an app that needs to run in the background. It plays online radio and at the same time must perform calculations.
I know there is a background expiration handler but it is very limited in time to my knowledge. Is there a way an app can perform calculations in the background for a very long time?
Someone mentioned something about specifying your app needs navigation and then it can keep doing important things. How?
From the Apple documentation:
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.
Your app seems to be ok for the
Apps that play audible content to the user while in the
background,such as a music player app
While your app is playing music you can do the calculation you are mentioning. For more info check the Apple documentation here

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

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.

iPhone Application Combined With Facebook

I need to know if this is possible. I want to develop an iPhone app that uses facebook credential to login (this is possible i know) and the create an event (like a dinner) and invite friends from facebook. When the time for the event comes (like 15-20 minutes before the start time) all the users that are attending the event can see how far are the others participants to this event using GPS (Core Location lookups) and see on a map as they move towards the place of the event
Yes. Everything you have described in your question is possible.
However, iPhone doesn't allow things like that to run in the background - your app would only work if each guest had the app open as they were travelling towards the event. The app would then update a server somewhere with their locations.
You might be able to do this with a notification that told them to open the app 10 minutes before the event started?
Android allows background tasks so you might want to write this for Android devices first and then make an iPhone version later?

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.

What's iOS 4.0 Location Multi-tasking abilities

Apple's developer website describe 3 types of background services an app can use, music, location and VoIP.
When they describe background location services they talk about 2 types of apps: critical and non-critical apps. A GPS navigation app falls into the 'critical' category, and location based social networks like Gowalla and Loops falls into the non-critical category.
I have several questions
I'm building a location based social network, like Google Latitude. this kind of app fall under the 'non-critical' category. these apps are woken up by the OS whenever the phone switches cellular towers. How often is that? how accurate is that? will 100 meter change wake up the app?
I was wondering if there is a way for an application to wake up every 2 minutes to sample the GPS and go back to sleep? 2.
I hear there are new Alerts feature that you can schedule in advance. can these alerts wake up the app, or are they only textual notification?
What if I register a thread as a critical-location thread, so I have full background activity and gps access. will Apple not approve my app?
Thanks!
As far as I know:
That depends on the Cell Coverage in your area. Might be 100m, might be 2km.
As far as I know not.
That's only the notification (like a push notification does not wake up the app)
It may be approved, but users will complain about unnecessary battery draining.