在Phonegap应用程序(Android)中未创建SQLite数据库

时间:2013-02-13 12:18:33

标签: android sqlite cordova

当我在Safari(桌面)或虚拟设备中测试我的应用程序时,我可以看到数据库是按预期创建的,但如果我在物理设备上运行相同的应用程序(galaxy note选项卡),我可以看到/ data文件夹在DDMS文件资源管理器中为空,我找不到数据库。

我正在尝试在onDeviceReady函数中创建数据库,我可以看到它按预期触发。

我是否需要root访问此设备?我查了一下,它没有扎根?

这是我的config.xml:

<?xml version="1.0" encoding="UTF-8"?>

<widget xmlns = "http://www.w3.org/ns/widgets"
    xmlns:gap = "http://phonegap.com/ns/1.0"
    id = "uk.co.epwin.ecobuild2013"
    version = "0.0.1"
    versionCode = "1">

<name>Ecobuild 2013</name>

<description>
app for the 2013 Ecobuild exhibition
</description>

<author href="http://www.epwin.co.uk" email="info@epwin.co.uk">
    Mike Mardon | Epwin Group Design Studio
</author>

<!-- ICONS -->
<icon src="images/icons/icon.png" /> <!-- default 72 pixels -->
<icon src="images/icons/ios/icon.png" width="57" height="57" /> <!-- iPhone 3G, iPhone 3GS, iPod Touch 2G, 3G -->
<icon src="images/icons/ios/icon72.png" gap:platform="ios" width="72" height="72" /> <!-- iPad, iPad 2, iPad mini -->
<icon src="images/icons/ios/icon114.png" width="114" height="114" /> <!-- iPhone 4, iPhone 4S, iPod Touch 4G -->
<icon src="images/icons/ios/icon144.png" width="144" height="144" /> <!-- iPad 3, iPad 4 -->
<icon src="images/icons/android/ldpi.png" gap:platform="android" gap:density="ldpi" /> <!-- 36 pixels -->
<icon src="images/icons/android/mdpi.png" gap:platform="android" gap:density="mdpi" /> <!-- 48 pixels -->
<icon src="images/icons/android/hdpi.png" gap:platform="android" gap:density="hdpi" /> <!-- 72 pixels -->
<icon src="images/icons/android/xhdpi.png" gap:platform="android" gap:density="xhdpi" /> <!-- 96 pixels -->
<icon src="images/icons/bb/icon.png" gap:platform="blackberry" /> <!-- 72 pixels -->
<icon src="images/icons/bb/icon_hover.png" gap:platform="blackberry" gap:state="hover"/> <!-- 72 pixels -->
<icon src="images/icons/winphone/icon.png" gap:platform="winphone" /> <!-- 57 pixels -->
<icon src="images/icons/winphone/tileicon.png" gap:platform="winphone" gap:role="background" /> <!-- 72 pixels -->
<icon src="images/icons/webos/icon.png" gap:platform="webos" /> <!-- 29 pixels -->
<icon src="images/icons/webos/miniicon.png" gap:platform="webos" gap:role="mini" /> <!-- 15 pixels -->

<!-- SPLASH SCREENS -->
<gap:splash src="images/splash/splash.png" /> <!-- default 320x480 pixels -->
<gap:splash src="images/splash/ios/1024x768.png" width="1024" height="768" /> <!-- iPad 1, iPad 2, iPad mini -->
<gap:splash src="images/splash/ios/768x1024.png" width="768" height="1024" /> <!-- iPad 1, iPad 2, iPad mini -->
<gap:splash src="images/splash/ios/320x480.png" width="320" height="480" /> <!-- iPh 3G / 3GS, iPod Touch 2, iPod Touch 3 -->
<gap:splash src="images/splash/ios/640x960.png" width="640" height="960" /> <!-- iPhone 4, iPhone 4S, iPod Touch 4 -->
<gap:splash src="images/splash/ios/640x1136.png" width="640" height="1136" /> <!-- iPhone 5, iPod Touch 5 -->
<gap:splash src="images/splash/android/ldpi.png" gap:platform="android" gap:density="ldpi" /> <!-- 200x320 -->
<gap:splash src="images/splash/android/mdpi.png" gap:platform="android" gap:density="mdpi" /> <!-- 320x480 -->
<gap:splash src="images/splash/android/hdpi.png" gap:platform="android" gap:density="hdpi" /> <!-- 480x800 -->
<gap:splash src="images/splash/android/xhdpi.png" gap:platform="android" gap:density="xhdpi" /> <!-- 720x1280 -->
<gap:splash src="images/splash/bb/splash.png" gap:platform="blackberry" /> <!-- BlackBerry 250x250 -->
<gap:splash src="images/splash/winphone/splash.jpg" gap:platform="winphone" /> <!-- Windows Phone 7 480x800 -->
<gap:splash src="images/splash/webos/splash.png" gap:platform="webos" /> <!-- WebOS 64x64 -->

<!-- GENERAL PREFERENCES -->
<!--<preference name="phonegap-version" value="2.2.0" /> if unspecified it will build with latest version--> 
<preference name="orientation" value="landscape" /> 
<preference name="target-device" value="universal" /> <!-- handset, tablet only applies to ios, other are universal -->
<preference name="fullscreen" value="true" /> 

<!-- iOS PREFERENCES -->
<preference name="webviewbounce" value="false" /> <!-- if screen "bounces" when scrolled beyond top or bottom on iOS -->
<preference name="prerendered-icon" value="true" />  <!-- if true, iOS won't apply its gloss to app's home screen icon -->
<preference name="stay-in-webview" value="false" /> <!-- if true, all links (even with target blank) will open in webview -->
<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="exit-on-suspend" value="true" /> <!-- if set to false, app will continue to run on suspend -->
<preference name="show-splash-screen-spinner" value="true" /> <!-- show spinner on the splash screen during app loading -->
<preference name="auto-hide-splash-screen" value="true" /> <!-- if false, it must be hidden using a JavaScript API -->

<!-- ANDROID PREFERENCES -->
<preference name="android-minSdkVersion" value="7" /> <!-- min Android 2.1 -->
<!-- <preference name="android-maxSdkVersion" value="17" /> max Android 4.2 -->
<preference name="android-installLocation" value="auto" /> <!-- internalOnly, auto or preferExternal -->
<preference name="splash-screen-duration" value="5000" /> <!-- 5 seconds  - for auto-hide behaviour call    navigator.splashscreen.hide(); in the device-ready method-->        
<preference name="load-url-timeout" value="20000" /> <!-- 20 seconds -->
<plugin name="Storage" value="org.apache.cordova.Storage" />

<!-- BLACKBERRY PREFERENCES -->
<preference name="disable-cursor" value="false" />

<!-- PHONEGAP API FEATURES PREFERENCES -->
<preference name="permissions" value="none"/>

<!-- If you do not want any permissions to be added to your app, add the
following tag to your config.xml; you will still have the INTERNET
permission on your app, which PhoneGap requires.
<preference name="permissions" value="none"/> -->

<!-- to enable individual permissions use the following examples -->
<!--<feature name="http://api.phonegap.com/1.0/battery"/>-->
<!--<feature name="http://api.phonegap.com/1.0/camera"/>-->
<!--<feature name="http://api.phonegap.com/1.0/contacts"/>-->
<feature name="http://api.phonegap.com/1.0/file"/>
<!--<feature name="http://api.phonegap.com/1.0/geolocation"/>-->
<!--<feature name="http://api.phonegap.com/1.0/media"/>-->
<!--<feature name="http://api.phonegap.com/1.0/network"/>-->
<!--<feature name="http://api.phonegap.com/1.0/notification"/>-->

1 个答案:

答案 0 :(得分:1)

您需要有根设备才能展开文件资源管理器上的data文件夹。它看起来很空但不是。

如果它适用于您的avd,它也可以在您的设备上运行,您只是无法访问文件资源管理器上的数据库文件。