AIR app still running when the iphone is blocked? - iphone

I just made a simple game with flash professional 6.0 and adobe AIR sdk 3.4 for iPhone.
The problem is this: when I lock the iphone pressing the power button, the screen switches off as usual, but the music of the game still sounds. If I exit the game pressing the home button it exits fine. Is only when locking the phone with the app opened.
Also, I opted-out of multitasking for my app, so if I close my app with the home button and I reload it, it loads the main menu.
Anyone knows how can I solve this?

Ok, after a lot of reading, it is a very very simple solution, just with this at the start of the app:
SoundMixer.audioPlaybackMode = AudioPlaybackMode.AMBIENT;
With this playback mode, the sound mutes when the app goes to the background.

Related

Why doesn't the exit fullscreen mode button exist in iPhone?

Background:
I have a live iPad app. in the apple store. I am now developing the iPhone version.
I used MPMoviePlayerController in the Ipad version. But, I had to use the MPMoviePlayer*View*Controller for the Iphone version to solve some orientation problem.
Problem:
In the iPad version when the user go to the fullscreen he will have the Done and the Exit Fullscreen Buttons.
In the iPhone version the Exit Fullscreen Button does not appear. Only the Done button is appearing.
Note 1:
Using the MPMoviePlayerController and not the ViewController won't solve the problem for the iPhone.
Note 2:
The done button will pause the movie while the exit button will keep the movie playing in the other view I have.
Any ideas, please help.

Is it possible to pause my flash app on iphone by pressing home button?

I'm quite new to Flash. So here's my problem: I've created my app and it works great. But when I press home button on my iphone, my app minimizes and when I open it from multitasking apps, it simply restarts. Is it possible to freeze or pause the game instead of stop? Thanks!
By default the application should be eligible for the 'freeze-drying' iOS4+ functionality that resumes an app from the last place it left off. That may require a setting to be adjusted in your app descriptor (UIApplicationExitsOnSuspend should be false).
If you simply need to save data when the application is quitting, you can listen for Event.EXITING on the NativeApplication:
NativeApplication.nativeApplication.addEventListener(Event.EXITING, onExit);

iphone ios application home button press/applicationDidEnterBackground crash

hallo, i am newbie in developing iphne/ios application and i have
encountered some problem
generrraly my app (which is iphone camera image processing app) has no
visible errors at today stage except the one
when i press the home button to send my app off screen (putting to the
background), and then press the app icon to 'wake it up' again
it crashes
what would it be...? what the reason of it would be?
what is done to my app (seen from the view of programmer
- i mean internal game state) by this home buton operation?
- what i should take care of before "applicationDidEnterBackground"
eventually?
thanx for answer
Is this happening when you are running it from Xcode? Xcode does not like it if you hit the home button and start it again from within the device/simulator. Is it crashing if you launch it from the device (or simulator) without Xcode running? If not, then there probably isn't a problem.

How to run my app even after iPhone screen locks?

I want my app (LaunchDaemon) to keep running even if user locks the iPhone. My LaunchDaemon simply check a file and if some condition is true, it displays an Alert to the User. Its working great when iPhone is on Home Screen, but it is not working when user Locks the Screen.
I want something Similar to Alarm app of iPhone which will show an Alert even if the iPhone screen is Locked.
Any suggestions on how to do this? BTW i am developing for JB iPhone.
OS powers down the device and suspends your app after about 30 seconds after screen is locked. However,
if your app is playing a sound OS will not do that. Hence what you need to do is play a silent sound in a loop.
Alright i have solved this problem too.
Here is a very good tutorial on how to prevent deep sleep of iPhone.
Prevent iPhone Deep Sleep
It took me quite sometime to made this work, as NSRunLoop was not running for me automatically.
Hope this will help someone else also.
Best of Luck !!!

iPod controls will exit my application

I would like to allow controlling the iPod on top of my application when the user double taps the home button. I know there are a few apps out there that allow this. Unfortunately my app just quits.
Do I have to set anything to allow this behavior?
Is it possible that my app prevents the iPod app from showing above it because it also plays a sound from time to time?
The double-tap-for-iPod behaviour, if people are using the defaults (most people do) only works to bring up the mini player if music is already playing.
Check out Settings > General > Home. As you can see, there are a variety of things the user can choose to happen on double-click. Below that list of things, there is the option for "iPod controls" - when playing music, show iPod controls. This is what you want, and unfortunately there is no way you can choose to override the default behaviour and show iPod controls when music isn't playing.
There are 2 other options (both for the user, not you unfortunately):
If they turn the screen off, whilst in your app, and then double-click the home button, the mini player will show on screen and then they can play music. They will then still be within your app when they turn on and unlock the screen.
If they have a 3G-S or latest iPod Touch, then holding the home button will bring up the voice command menu, from which they can play music. They will then still be in your app when that menu closes.
Probably not the answer you wanted, but that's iPhone development for you!