sqlite3 - Android 4.4 and above version how to insert record in SQLite database on SD card -
i have read , write sqlite database on sd card (not in internal storage). i'm familiar sqlite pattern:
database = sqlitedatabase.opendatabase("mnt/sdcard2/test/temp/abcd.db",null, sqlitedatabase.open_readwrite); and sure "abcd.db" exists on sdcard.
but following error:
cannot open file @ line 30217 of [00bb9c9ce4] failed open database '/mnt/sdcard2/test/temp/abcd.db' android.database.sqlite.sqlitecantopendatabaseexception: unknown error (code 14): not open database
this code working fine android 4.2.* , below. i'm having problem android version 4.4 , above.
please me.
thanks.
since android 4.4 can't freely access sd card outside of apps package directory. follow instructions https://source.android.com/devices/storage/index.html , change path on sd card according example given
for example, app package name com.example.foo can freely access android/data/com.example.foo/ on external storage devices no permissions.
if want acces other directory use storage access framework https://developer.android.com/guide/topics/providers/document-provider.html
Comments
Post a Comment