ngCordova sqlite plugin database write error on Android -


i've got project using cordova (ionic framework) ngcordova , cordovasqlite plugin. plugin installed, js has been added html, write_external_storage permission added androidmanifest, , following 2 lines in config.xml

<preference name="androidpersistentfilelocation" value="compatibility" /> <preference name="androidextrafilesystems" value="sdcard,cache" /> 

however, when run example code:

$cordovasqlite.opendb({name: "wt.db"}); $cordovasqlite.execute(db, "create table if not exists people (id integer primary key, firstname text, lastname text)"); 

i error e/cutils(1910): failed mkdirat(/storage/usbdisk0/android): read-only file system

i checked on android device (s3 running aokp), , have empty /storage/usbdisk0 no android folder in there, , superuser can't create it. have /storage/sdcard0 , /storage/sdcard1 , /storage/emulated (with 0 , legacy inside linked internal sd card).

i'm assuming problem default directory plugin uses store databases wrong phone, means wrong anyone's phone.

if assumption correct, how plugin put database in right place?

i read config.xml preferences (which had copied , pasted documentation) said. problem <preference name="androidpersistentfilelocation" value="compatibility" /> causing file created in wrong place.

if replace both preference lines <preference name="androidpersistentfilelocation" value="internal" />, no longer need ask write_external_storage permission , works fine.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -