Question

I'm developing crossplatform application, using cordova 3.0.0. The project is created using cordova-cli and built for android platform. It successfully using file and file-transfer plugins at the moment. The problem comes when attempting to use Storage API. According to PhoneGap documentation, Storage API is built into cordova since version 3.0. The problem is, when I'm trying to interact with Storage API

var db = window.openDatabase(name, "1.0", name, size);

Cordova's PluginManager logs error:

exec() call to unknown plugin: Storage

So, the question is: Why does cordova tries to invoke Storage via PluginManager?

Also posting my config.xml:

<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.helloCordova" version="2.0.0" xmlns="http://www.w3.org/ns/widgets">
    <name>Hello Cordova</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <feature name="App">
        <param name="android-package" value="org.apache.cordova.App" />
    </feature>
    <feature name="File">
        <param name="android-package" value="org.apache.cordova.core.FileUtils" />
    </feature>
    <feature name="FileTransfer">
        <param name="android-package" value="org.apache.cordova.core.FileTransfer" />
    </feature>
    <access origin="*" />
    <preference name="useBrowserHistory" value="true" />
    <preference name="exit-on-suspend" value="false" />
    <preference name="fullscreen" value="true" />
    <preference name="webviewbounce" value="true" />
</widget>

and AndroidManifest.xml

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="com.isd.immersivereader" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:debuggable="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="ImmersiveReader" android:theme="@android:style/Theme.Black.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>

The version of cordova.js, I'm using is 3.0.0-0-ge670de9 (as far as I know it's a head revision) and it does have Storage defenition.

If more information is required - just let me know).

Thank you in advance.

Was it helpful?

Solution

Using Cordova >=3.0.0, you need to add the storage feature to your config.xml (app/res/xml/config.xml). E.g.

<feature name="Storage">
    <param name="android-package" value="org.apache.cordova.Storage" />
</feature>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top