After reading replies to other posts I placed regarding going into background mode and playing an audio mp3 file, I was directed to read: http://developer.apple.com/library/ios/ ... sFlow.html
The document was not user friendly but I was able to find out from it I needed to alter a file called Info.plist and add a key called UIBackgroundModes into it. Key? Huh?

I went onto Stackoverflow and found out what that key was about and added the key to the end of all copies of settings.plist because I saw in other LiveCode posts that was where it should be.
Here is the key in one of the settings.plist files:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleBundleName</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleResourceSpecification</key>
<string>ResourceRules.plist</string>
<key>CFBundleSignature</key>
<string>????</string>
${URL_TYPES}
${REMOTE_NOTIFICATION_TYPES}
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundleVersion</key>
<string>${BUNDLE_VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>${BUNDLE_VERSION}</string>
<key>CFBundleIconFiles</key>
<array>
${BUNDLE_ICONS}
</array>
<key>DTCompiler</key>
<string>4.2</string>
<key>DTPlatformBuild</key>
<string>10A403</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>DTPlatformVersion</key>
<string>6.0</string>
<key>DTSDKBuild</key>
<string>10A403</string>
<key>DTSDKName</key>
<string>iphoneos6.0</string>
<key>DTXcode</key>
<string>0450</string>
<key>DTXcodeBuild</key>
<string>4G182</string>
<key>CFBundleDisplayName</key>
${BUNDLE_DISPLAY_NAME_SUPPORT}
<key>MinimumOSVersion</key>
${MINIMUM_OS_SUPPORT}
<key>UIDeviceFamily</key>
<array>
${DEVICE_SUPPORT}
</array>
<key>UIRequiredDeviceCapabilities</key>
<dict>
${DEVICE_CAPABILITY}
</dict>
<key>UIRequiresPersistentWiFi</key>
${PERSISTENT_WIFI}
<key>UIInitialInterfaceOrientation</key>
${IPHONE_INITIAL_ORIENTATION}
<key>UISupportedInterfaceOrientations</key>
<array>
${IPHONE_SUPPORTED_ORIENTATIONS}
</array>
<key>UIInitialInterfaceOrientation~ipad</key>
${IPAD_INITIAL_ORIENTATION}
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
${IPAD_SUPPORTED_ORIENTATIONS}
</array>
<key>UIStatusBarHidden</key>
${STATUS_BAR_HIDDEN}
<key>UIStatusBarStyle</key>
${STATUS_BAR_STYLE}
<key>UIFileSharingEnabled</key>
${FILE_SHARING}
<key>UIPrerenderedIcon</key>
${PRE_RENDERED_ICON}
<key>UIAppFonts</key>
<array>
${CUSTOM_FONTS}
</array>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
</dict>
</plist>
Code: Select all
mergBgTaskStart
Code: Select all
on updateTime
put long time into field "lblCurrentTime"
send "updateTime" to me in 500 milliseconds
/*
|| Slice up the time into it's components.
*/
set the itemDel to ":"
put word 1 of item 2 of field "lblCurrentTime" into intMinutes
put word 1 of item 3 of field "lblCurrentTime" into intSeconds
/*
|| Play the correct sounds on the quarters when those times are reached.
*/
if intSeconds = "00" then
put intMinutes into field "lblMinutes"
end if
if intSeconds = "00" and intMinutes = "15" then
play specialFolderPath("engine") & "/Sound Files/quarter.mp3"
end if
if intSeconds = "00" and intMinutes = "30" then
play specialFolderPath("engine") & "/Sound Files/half.mp3"
end if
if intSeconds = "00" and intMinutes = "45" then
play specialFolderPath("engine") & "/Sound Files/quarter_before.mp3"
end if
if intSeconds = "00" and intMinutes = "00" then
play specialFolderPath("engine") & "/Sound Files/hourly.mp3"
end if
end updateTime
Can you provide a tutorial for people like me to get this set up correctly so the audio will play in the background? In the Apple documentation they did not give any example on how to do it. I had to go to another source for that info.
The apple documentation also says this:
As long as it is playing audio or video content, the app continues to run in the background.
This makes me believe that I would need to start a sound file playing prior to allowing the user to tap the home button. Does this mean in order for the app to stay in the background I need to have a sound file playing even if that sound file is playing with no volume running prior to playing the other sound files?
Thanks.