mirror of
https://github.com/moparisthebest/PhoneGap-SQLitePlugin-Android
synced 2024-11-21 08:25:01 -05:00
Small fix from Storage.java, from incubator-cordova-android
This commit is contained in:
parent
7fe4928f0b
commit
5b725d5cd1
@ -12,6 +12,8 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.apache.cordova.api.Plugin;
|
||||
import org.apache.cordova.api.PluginResult;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.*;
|
||||
|
||||
@ -145,10 +147,12 @@ public class SQLitePlugin extends Plugin {
|
||||
* If db was loaded with project or downloaded externally
|
||||
*/
|
||||
public void setStorage(String appPackage, Boolean preLoaded) {
|
||||
/**
|
||||
if(preLoaded)
|
||||
this.path = "/data/data/" + appPackage + "/databases/";
|
||||
else
|
||||
this.path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/";
|
||||
**/
|
||||
}
|
||||
|
||||
/**
|
||||
@ -173,9 +177,12 @@ public class SQLitePlugin extends Plugin {
|
||||
|
||||
// If no database path, generate from application package
|
||||
if (this.path == null) {
|
||||
/**
|
||||
Package pack = this.ctx.getClass().getPackage();
|
||||
String appPackage = pack.getName();
|
||||
this.setStorage(appPackage, false);
|
||||
**/
|
||||
this.path = this.cordova.getActivity().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
|
||||
}
|
||||
|
||||
this.dbName = this.path + db;
|
||||
|
@ -163,7 +163,7 @@ These installation instructions are based on the Android example project from Ph
|
||||
|
||||
- Install Android/assets/www/SQLitePlugin.js from this repository into assets/www subdirectory
|
||||
- Install Android/src/com/phonegap/plugin/sqlitePlugin/SQLitePlugin.java from this repository into src/com/phonegap/plugin/sqlitePlugin subdirectory
|
||||
- Add the plugin element <plugin name="SQLitePlugin" value="com.phonegap.plugin.sqlitePlugin"/> to ~res/xml/config.xml~ res/xml/plugins.xml
|
||||
- Add the plugin element <plugin name="SQLitePlugin" value="com.phonegap.plugin.sqlitePlugin"/> to ~~res/xml/config.xml~~ res/xml/plugins.xml
|
||||
|
||||
Sample change to res/xml/plugins.xml:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user