2013-02-13 147 views
0

當我在Safari(桌面)或虛擬設備中測試我的應用程序時,可以看到數據庫按預期創建,但是如果我在物理設備上運行相同的應用程序(星系note選項卡)我可以看到/ data文件夾在DDMS文件資源管理器中是空的,我找不到數據庫。未在Phonegap應用程序中創建SQLite數據庫(Android)

我正在嘗試在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="[email protected]"> 
    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"/>--> 

+0

抱歉只是重申,它在我的AVD – Mike 2013-02-13 12:20:07

回答

0

你需要一個植根設備以擴大在文件瀏覽器中data文件夾。它看起來是空的,但它不是。

如果它在你的AVD上工作,它也應該在你的設備上工作,你只是無法訪問文件資源管理器上的數據庫文件。

+0

上工作,感謝這一點,我認爲儘可能多的和隨後的測試證實你的答覆! – Mike 2013-02-13 13:59:00

相關問題