setInterval() stopped working on Android on one device

1,309 views
Skip to first unread message

j99

unread,
Jul 30, 2012, 3:36:42 AM7/30/12
to phon...@googlegroups.com
I am developing a simple Phonegap based app for Android that uses setInterval for some featuers as well as accelerometer for some gestures. I am testing it on 3 different devices and suddenly all features that are in any way related to setInterval function (including accelerometer) stopped working on one of my devices (Samsung Galaxy 5 i5500). First I thought there is a hardware failure but all my other apps and also games still work on this device, even with accelerometer. I can not even get the example running from http://docs.phonegap.com/en/2.0.0/cordova_accelerometer_accelerometer.md.html#Accelerometer.

When I execute

var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);

it returns watchID but never executes function onSuccess() ...

I already tried everything:
- app data from phone, uninstalling app
- switching to different version of Phonegap (I tried v1.5, 1.8.1, 1.9 and 2.0)
- resetting phone to factory defaults
- using newer version of Eclipse
- I also created a new "hello world" application that includes only setInterval example
etc.

...and the setInterval() still won't fire...  Here's the code that is called on device ready event:

setInterval(intervalFunction, 1000);

function intervalFunction() {
  console.log("inerval...");
}

This intervalFunction() never gets executed on i5500 (but it was working a few days ago). But I must point out again that it works on other devices and also other (non-phonegap accelerometer apps) work correctly on i5500.

Does anybody have a same issue? Is there any way to get rid of this?

j99

unread,
Jul 30, 2012, 3:48:23 AM7/30/12
to phon...@googlegroups.com
Update: found out that setInterval occasionally works but accelerometer still never fires... even if I use navigator.accelerometer.getCurrentAcceleration(onSuccess, onError) no function is executed

Christophe Guilmart

unread,
Jul 30, 2012, 6:00:14 AM7/30/12
to phon...@googlegroups.com
I did have an very strange issue with Samsung Galaxy S3 that may be releated to your.

the settimout function was not executing properly.

After a lot of test, I found out that I could NOT change the CSS background of a div to full transparent (alpha = 0) inside the timeout. So I change it to 0.1 instead.
This bug is specific to this device (we test on a lot of devices).

hope this help you (or someone else)
Message has been deleted

Saffar Mudzakir

unread,
Mar 9, 2014, 7:10:32 AM3/9/14
to phon...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages