Skip to main content
Feb 3, 2012 10:17 PM UTC
Question

Sound stops when iPhone goes to sleep

I have an app in which the primary function is to play relaxing sounds for several minutes at a time. The sounds are activated by buttons on the screen. It all works perfectly until the iphone goes to sleep, at which point the currently playing sound stops. Is there a way to make the sound continue to play even when the iPhone's screen automatically goes black?

This topic is closed to new replies. Start a new post to keep the conversation going.

6 replies

Feb 7, 2012 4:22 PM UTC

I was able to add the code and keep it there by using the File menu to publish, but the sounds still stop when the phone goes to sleep. Here's the section of code from the application descriptor:

<iPhone>

        <requestedDisplayResolution>high</requestedDisplayResolution>

        <InfoAdditions><![CDATA[<key>UIDeviceFamily</key><array><string>1</string></array><key>UIBackgroundModes</key>

            <array>

                <string>audio</string>

                <!-- audio background mode key -->

            </array>]]></InfoAdditions>

    </iPhone>

</application>

I must still be doing something wrong...

Translate
Colin Holgate
Inspiring
Feb 7, 2012 4:27 PM UTC

Is the space in the word "string" really there?

Translate
Feb 7, 2012 4:30 PM UTC

Ha, I didn't notice that. It's not really there though.

Translate
Adobe Employee
Feb 7, 2012 5:28 AM UTC

Are you missing the  UIBackgroundModes tag in the application descriptor?

<key>UIBackgroundModes</key>
    
<array>
           
<string>audio</string> <!-- audio background mode key -->
     
</array>


Translate
Feb 7, 2012 3:55 PM UTC

I tried to manually add that code to the InfoAdditions section of the XML file, but it got erased automatically when I published the app. Did I do it the wrong way?

Translate
Colin Holgate
Inspiring
Feb 7, 2012 4:02 PM UTC

Use Publish from the File menu, not from the settings dialog. If you do it from the settings dialog is will re-write the app descriptor file, and may undo your manual changes.

Translate