How does skype remain on top when call is in process and you switch to other app in iPhone - iphone

what iOS feature does skype app use where it can remain on top of other apps with a drop down like bar even if you run other apps?

Skype uses the iOS 4 multitasking APIs, specifically VoIP multitasking in order to keep the call active while the rest of the app is suspended.
When the app is sent to the background, Skype informs the system that it would like to keep its network connection alive and that the audio subsystem should remain active.
The system continues to look after the network connection, passing received data back to Skype in order for it to process the audio.
This is one of the three main forms of multitasking in iOS, the others being: audio streaming, like Pandora and location services, like Tom Tom navigation.

It does this via the background execution APIs available starting in iOS 4. More information about how it works can be found in the Implementing a VoIP Application subsection on this page in the iOS Application Programming Guide.

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

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.

iphone: backgrounded app sync webservice

I know this question may be a little bit common and over asked but I cannot find any precise information... so :
Is it possible to have some kind of thread running when the app is in background so I can perform basic sync with my webservice ?
App is in background : I mean the user clicked the Home button, or switched to another app
basic sync : photo upload and download with AFNetworking. I know it has method to continue an HTTPRequest while app is in background, but this is not my point.
My goal would be to make some kind of sync manager, reading a list of photos to update created while the user was on the app, and perform those changes.
I know that the manager could be killed by the OS, but since my server uses atomic transfers it is not a problem. I just need a way to relaunch it... Push ?
I think apps like Google Latitude or Mail and those kind of apps uses what I am looking for but I cannot find any relevant details on it. And using iOS5 is not a problem but waiting for iOS6 would not be a solution.
Thank you for your replies !
PS : well I almost forgot. the app is designed for an enterprise program, so maybe rules are different ? I don't think there is any check for in-house deployment so it might lead to new possibilities...
Apple's Mail client has a background daemon which keeps it running but you can't have that with your own applications. Once an app enters a background state, it must halt it's operations. You can request for a little more time when backgrounded to finish off any transfers or writes to disk (see the Executing a Finite-Length Task in the Background section on Apple's Multitasking Guide)
Google Latitude has events generated based on location. This is a special type of backgrounding introduced by Apple for certain types of applications (see Implementing Long-Running Background Tasks section on Apple's Multitasking Guide) but this can't be used for HTTP syncing. It can only be used for audio, location, voip, newstand content, bluetooth and external hardware attachments.
Push doesn't seem like a solution because it only generates an alert. It doesn't trigger any action until the user triggers the opening of the notification.
You'll want to read Tech Note 2277 Networking and Multitasking.
Basically you have a couple of options:
If you can convince Apple that your app is a VoIP app then you can register a VoIP socket and the OS will resume your background app whenever there is activity on that socket.
Your main option though is to register a background task for any outstanding activity that you have to do when your app is put in the background. You typically get 10 minutes to finish up that work.
Mail is a special app with privileges you don't get.
Apps like Latitude typically register themselves for location updates, specifically to be woken up when there are major geo-position changes. Apps that record GPS tracks do similar things.
Found it !
Using Suhail Patel 's link on Apple's Multitasking Guide I added the voip tag to UIBackgroundModes in Info.plist and use setKeepAliveTimeout:handler: method of UIApplication to relaunch it if needed once the app is going to sleep.
I hope this will help a lot of you !
Of course this app won't be allowed to be on the App Store but for in house development this is in my opinion the best way to do so.
Thanks everyone for showing me the right direction !

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.