PhoneGap's vibrate() and beep() functions break in iPhone, Android emulators
Posted
by Steve Nay
on Stack Overflow
See other posts from Stack Overflow
or by Steve Nay
Published on 2010-05-20T20:56:49Z
Indexed on
2010/05/20
21:00 UTC
Read the original article
Hit count: 318
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?
© Stack Overflow or respective owner