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

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.

Related

How to set bluetooth communication to run in background

I am working on a medical related app where a medical device interfaces via bluetooth with an iphone. However I cannot figure out how to allow the app to run indefinately in the background. Right now it only communicates when the app is open. I have been reading a lot of questions related to this and I haven't managed to find an answer which fits. I'm sorry if this is a duplicate. Can someone point me in the direction of how to implement this.
ETA - I just got confirmation that this is supposed to be able to go on the App Store.
Did you come across this question: Background time issue for Bluetooth LE app for Iphone 4s
It seems that adding the background mode bluetooth-central (see documentation) can enable your app to run in the background while handling bluetooth events. As noted in the question above though, you could always set background mode to audio and play a blank looping audio track to keep your app alive and responding if you don't need to be on the App Store.

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.

How to get phone call ended notification after application is closed for iPhone?

In an iPhone app every time I end the phone call I want to ask user for yes/no type question & if 'Yes' is clicked the launch my application. I know I can get notifications for call end using CTTelephone but my question here is that is it possible to get the notifications even after my application is closed. If I run my application in background then there are chances that system closes it on low memory. Moreover apple doesn't support for continuos background application.
No, you will not get notification if your app is close. Since you app does not fall in one of the background modes you will not be able to run the app in the background.
In short, the functionality you want is not possible with the official Apple SDK and guidelines.

Why does my iPhone App continue in the background?

I wrote my first iPhone App, and managed to get it into the App store. I later discovered a bug that happens on a real device but not on my emulator. I have committed a fix (changed plist to prevent app running in background), but I don't really understand why it happened.
My App allows users to record a sound-byte, however while they are recording they can use the iPhone home button to move the app to the background, and then it can keep recording forever if they don't restart the phone or the app does not crash.
My impression from everything I have read, is that this should not happen as you have to ask for background audio specifically if you want to do this, but now it appears to me that you have to ask specifically to disable it.
Could anyone explain this to me?
The iOS App lifecycle is described in Apple's iOS App Programming Guide.
The App is given the opportunity to save data and otherwise stop things that don't need to be running, before being suspended. You can request extra time doing this by using beginBackgroundTaskWithExpirationHandler:.
If you want your app to stop doing its "normal thing" when it is put into the background then you need to detect the App state transition and stop it yourself.

How does skype remain on top when call is in process and you switch to other app in 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.