wimpie3 Well-Known Member Licensed User Longtime User Mar 27, 2015 #1 I'm currently testing an app on several devices. One of them, an older HTC, crashes with the following error: android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file This happens in a module on this line: Code: SQL.Initialize(File.DirDefaultExternal, "mydb.db", True) Since the "true" flag is passed, a new db should be created, but for one reason or another this does not seem to work on this specific device. What am I missing?
I'm currently testing an app on several devices. One of them, an older HTC, crashes with the following error: android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file This happens in a module on this line: Code: SQL.Initialize(File.DirDefaultExternal, "mydb.db", True) Since the "true" flag is passed, a new db should be created, but for one reason or another this does not seem to work on this specific device. What am I missing?
DonManfred Expert Licensed User Longtime User Mar 27, 2015 #2 wimpie3 said: What am I missing? Click to expand... my guessing: permission to write on external storage? Upvote 0
wimpie3 said: What am I missing? Click to expand... my guessing: permission to write on external storage?
wimpie3 Well-Known Member Licensed User Longtime User Mar 27, 2015 #3 Uhmmm... so why would it work on other machines and not on my HTC? Plus, this is what Erel wrote before: File.DirRootExternal and File.DirDefaultExternal have a special side effect of adding the STORAGE permission to your manifest file. Click to expand... Upvote 0
Uhmmm... so why would it work on other machines and not on my HTC? Plus, this is what Erel wrote before: File.DirRootExternal and File.DirDefaultExternal have a special side effect of adding the STORAGE permission to your manifest file. Click to expand...
DonManfred Expert Licensed User Longtime User Mar 27, 2015 #4 Except if you are using a removepermission Upvote 0
Pendrush Well-Known Member Licensed User Longtime User Mar 27, 2015 #6 Code: If File.ExternalWritable = True Then SQL.Initialize(File.DirDefaultExternal, "mydb.db", True) Else SQL.Initialize(File.DirInternal, "mydb.db", True) End If Upvote 0
Code: If File.ExternalWritable = True Then SQL.Initialize(File.DirDefaultExternal, "mydb.db", True) Else SQL.Initialize(File.DirInternal, "mydb.db", True) End If
Pendrush Well-Known Member Licensed User Longtime User Mar 27, 2015 #7 Or you can use this code: Code: SQL.Initialize(DataBasePath, "mydb.db", True) Sub DataBasePath As String If File.ExternalWritable = True Then Return File.DirDefaultExternal Else Return File.DirInternal End If End Sub Upvote 0
Or you can use this code: Code: SQL.Initialize(DataBasePath, "mydb.db", True) Sub DataBasePath As String If File.ExternalWritable = True Then Return File.DirDefaultExternal Else Return File.DirInternal End If End Sub
wimpie3 Well-Known Member Licensed User Longtime User Mar 27, 2015 #8 This seems to have done the trick... can't I use DirInternal on all occasions and simply leave out the if/then/else? Upvote 0
This seems to have done the trick... can't I use DirInternal on all occasions and simply leave out the if/then/else?
Pendrush Well-Known Member Licensed User Longtime User Mar 27, 2015 #9 Check my post above your. Or always use DirInternal. Upvote 0