I’m working on the iOS version of my phonegap-based navigation app. My app tracks the user’s location around a walk route using GPS and alerts the user using audio (navigator.notification.beep) and tactile (navigator.notification.vibrate) feedback when they reach a location at which there’s new instructions for them to follow.
When my app is running in the foreground, both the audible beep and the vibration fire on reaching the geographic location but when the app is paused in the background, either by pressing the power button to turn the screen off or pressing the home button to return to the springboard, only the vibration works - the beep is not audible. I’ve added debug so I can see in the log file that the app is calling navigator.notification.beep() while in the background but the beep sound isn't made. I’ve tested my app on an iPhone 4S running iOS 6.3.1 and iPad 2 running iOS 5.1.1. Obviously the iPad doesn’t vibrate but the beep works while the app is in the foreground but not when in the background.
- My app is using Phonegap 2.5.0
- I’m using latest Xcode v4.6.2 with latest SDK for iOS 6.3.1
- I’m using a beep.wav in the /www root
- My app’s .plist sets “UIBackgroundModes” of “location” and “audio”
My config.xml contains the settings:
<plugin name="Notification" value="CDVNotification" />
<plugin name="Media" value="CDVSound" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="AllowInlineMediaPlayback" value="true" />
Any suggestions how to fix this would be most appreciated :-)