views:

358

answers:

1

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 capable (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?

+1  A: 

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?

sgarman
Precisely. The devices themselves do just fine (as long as they have the physical capability to do vibration/beeping), but the emulators sometimes die. Is there a PhoneGap workaround for the emulators?
Steve Nay