I'm using Sencha Touch 2.0.1 and am trying to open a SQLite Database using:
var db = window.openDatabase("mydatabase", "1.0", "mydatabase", 2000000);
On the iPhone/IOS Simulator this works. On an Android device or emulator I get an exception:
TypeError: Object[object DOMWindow] has no method 'openDatabase'
I'm using Sencha to build native apps (though am rapidly losing faith...) so am not using PhoneGap.
Sencha's packaging creates and AndroidManifest.xml file but I can't see permissions set for
android.permission.WRITE_EXTERNAL_STORAGE
I'm not sure if this is the problem though!
Any help greatly appreciated as this is driving me quietly nuts.
Edit: Here's the JS - it's part of a Sencha Touch generated app:
Ext.application({
name: 'MyApp',
requires: [
'Ext.MessageBox'
],
views: ['Main'],
icon: {
'57': 'resources/icons/Icon.png',
'72': 'resources/icons/Icon~ipad.png',
'114': 'resources/icons/Icon@2x.png',
'144': 'resources/icons/Icon~ipad@2x.png'
},
isIconPrecomposed: true,
startupImage: {
'320x460': 'resources/startup/320x460.jpg',
'640x920': 'resources/startup/640x920.png',
'768x1004': 'resources/startup/768x1004.png',
'748x1024': 'resources/startup/748x1024.png',
'1536x2008': 'resources/startup/1536x2008.png',
'1496x2048': 'resources/startup/1496x2048.png'
},
launch: function() {
// Destroy the #appLoadingIndicator element
Ext.fly('appLoadingIndicator').destroy();
// Initialize the main view
Ext.Viewport.add(Ext.create('MyApp.view.Main'));
//
try {
var db = window.openDatabase("mydatabase", "1.0", "mydatabase", 2000000);
if ( !db ) {
var m3 = new Ext.MessageBox();
m3.alert("db test!", "openDatabase failed!");
} else {
var m3 = new Ext.MessageBox();
m3.alert("db test!", "openDatabase ok!");
}
}
catch(err){
var m2 = new Ext.MessageBox();
m2.alert("db test!", "exception caught: " + err.name + ":" + err.message);
}
}
});