views:

202

answers:

1

I'm trying to build an offline web application which can sync online if the network is available. I tryed jQuery jStore but the test page stop at "testing..." whitout result, then I tryed Google Gears which is supposed to be working on the phone but it is not found.

 if (window.google && google.gears)
 {
  google.gears.factory.getPermission();

  // Database
  var db = google.gears.factory.create('beta.database');
  db.open('foobar');
  db.execute('create table if not exists Lectures' +
           ' (ID_COMPTEUR int, DATE_HEURE timestamp, kWh float, Wmax float, VAmax float, Wcum float, VAcum float);');

 }
else
{
alert('Google Gears non trouvé.');      
}

the code does work on Google Chrome v5.

[edit]

alert(window.google); on the phone is undefined, but is an object in Chrome.

alert(google.gears); does nothing on the phone and jam the javascript, but is an object in Chrome.

[edit 2]

in the phone configuration, gears is activated.

[edit 3]

to be clear, you have to use google.gears database on Android 1.5, and html5's localStorage on Android 2.x

+1  A: 

Got it! "gears_init.js" wasn't loading correctly. My code was using:

<script type="text/javascript" src="gears_init.js"></script>

whitout having the file locally. I downloaded the file from google and now it works. I don't know why it was Chrome working correctly on chrome..

Sirber