ios 4.1 doesn't call Phonegap API
- by Johannes Klauß
I'm working on a cross platform app for Android 2.2 and iOS 4.1 (dev devices).
On Android everything works fine (accelerometer and geolocation) even if it's a little laggy.
On iOS it's way more smooth, but he doesn't call the Phonegap functions. That's my JS code:
var watchID = null;
var shaking = {
left: false,
right: true
};
function startWatch() {
// Update acceleration every 100 ms
var options = {
frequency : 100
};
watchID = navigator.accelerometer.watchAcceleration(function(acceleration) {
if(acceleration.x < -8) {
shaking.left = true;
}
else if(acceleration.x > 8) {
shaking.right = true;
}
if(shaking.left && shaking.right) {
navigator.notification.vibrate(500);
shaking.left = false;
shaking.right = false;
stopWatch();
}
}, null, options);
}
I just call it with
<a href="" onclick="startWatch();">start Accel</a>
But iOS doesn't react at all.
Is there any special call you need to do in iOS?