PhoneGap's vibrate() and beep() functions break in iPhone, Android emulators
I have a PhoneGap app that I'm testing on webOS, Android, and iPhone. I'm using physical devices as well as emulators (the ones that come with their respective SDKs, not the PhoneGap emulator).
Part of the code uses the navigator.notification.vibrate()
and navigator.notification.beep()
functions.
All the physical devices I'm using either perform the behavior or ignore it if they're not capab开发者_开发百科le (e.g., the iPod can't vibrate). However, the emulators behave differently.
The Android emulator kills the app whenever the beep()
function is called. The iPhone emulator causes the app to hang whenever the vibrate()
function is called.
Is there any way to get the emulators to ignore those function calls when they are unable to execute them? That is, is there a way to get them to degrade gracefully so I can test the app both places without having to modify the code specifically for the emulators?
I don't think this is an issue with the emulators. I can use both vibration and audio alerts in my native applications. These both function fine in the emulator. I think it the problem is how PhoneGap is handling these functions in native code. Are you suggesting that these functions work on the device but not the emulator?
精彩评论