I am building an application using PhoneGap on Android and iOS, we're using WebSQL to persist some items. The application runs fine and persists on iOS properly, however the behaviour doesn't seem to be working on Android (4.2.1 Galaxy Nexus).
We open our database with:
window.openDatabase('name', '', 'name', size)
However between restarts of the application on Android it appears to be opening a NEW database every time. Is this expected behaviour, or am I missing something completely?
On Wednesday, February 13, 2013 8:06:04 AM UTC-5, to...@tomb.io wrote:
> I am building an application using PhoneGap on Android and iOS, we're > using WebSQL to persist some items. The application runs fine and persists > on iOS properly, however the behaviour doesn't seem to be working on > Android (4.2.1 Galaxy Nexus).
> We open our database with:
> window.openDatabase('name', '', 'name', size)
> However between restarts of the application on Android it appears to be > opening a NEW database every time. Is this expected behaviour, or am I > missing something completely?
We narrowed it down to the first run it throwing SECURITY_ERR, so cordova.js uses storage.openDatabase, but subsequent runs it doesn't throw SECURITY_ERR so seems to use the browser's window.openDatabase which I assume is opening a 'new' database and therefore not reading the existing one. I monkey patched cordova.js to always use storage.openDatabase on Android which I feel isn't a great solution.
On Wednesday, 13 February 2013 22:32:01 UTC, Sam wrote:
> Strange, we use WebSQL on Android without any problem : > openDatabase('mosadb, '1.0', 'Desc Database', 4 * 1024 * 1024);
> On Wednesday, February 13, 2013 8:06:04 AM UTC-5, to...@tomb.io wrote:
>> I am building an application using PhoneGap on Android and iOS, we're >> using WebSQL to persist some items. The application runs fine and persists >> on iOS properly, however the behaviour doesn't seem to be working on >> Android (4.2.1 Galaxy Nexus).
>> We open our database with:
>> window.openDatabase('name', '', 'name', size)
>> However between restarts of the application on Android it appears to be >> opening a NEW database every time. Is this expected behaviour, or am I >> missing something completely?