开发者

Correct path to sqlite database used by JAR imported into my Android app?

开发者 https://www.devze.com 2022-12-21 14:23 出处:网络
My Android app is using a database through an API packaged in an external JAR. Since the JAR is opening/updating/closing the SQLite database file, do I need to make sure it uses its own package name i

My Android app is using a database through an API packaged in an external JAR. Since the JAR is opening/updating/closing the SQLite database file, do I need to make sure it uses its own package name instead of my own? Im getting errors where it fails to open the database file and Im guessing its because the package name Im telling it to use is incorrect: should it be using the package name in the JAR file?

Code that is opening the database:

    public AndroidSQLiteDataStore() throws SQLiteException {
        Logger logger = LoggerFactory.getDefaultInstance();
        logger.information(TAG, "OPEN CONNECTION TO DATABASE " + Config.BN_ANDROID_DB_PATH);
        try {
            this.db =开发者_Python百科 SQLiteDatabase.openDatabase(Config.ANDROID_DB_PATH, null, SQLiteDatabase.CREATE_IF_NECESSARY | SQLiteDatabase.OPEN_READWRITE);
        } catch (SQLiteException e) {
            logger.error(TAG, e.toString());
            throw e;
        }
    }

Also tried poking around with the shell:

$ adb shell
$ ls
sqlite_stmt_journals
cache
sdcard
etc
system
sys
sbin
proc
logo.rle
init.sapphire.rc
init.rc
init.goldfish.rc
init
default.prop
data
root
dev
$ cd data
$ ls
opendir failed, Permission denied
$ 


Since the JAR is opening/updating/closing the SQLite database file, do I need to make sure it uses its own package name instead of my own?

JARs don't have package names from an Android standpoint.

0

精彩评论

暂无评论...
验证码 换一张
取 消