Skip to main content
February 3, 2012
Question

Sound stops when iPhone goes to sleep

  • February 3, 2012
  • 2 replies
  • 1249 views

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 has been closed for replies.

2 replies

February 7, 2012

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...

Colin Holgate
Inspiring
February 7, 2012

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

February 7, 2012

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

Adobe Employee
February 7, 2012

Are you missing the  UIBackgroundModes tag in the application descriptor?

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


February 7, 2012

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?

Colin Holgate
Inspiring
February 7, 2012

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.