Hi guys, i’m implementing an Android App that communicates with a sqlite database. It was going all fine until i built the app and opened it on my mobile…
The problem that i’m facing now is that console shows the error “unable to open database file” if i leave the database on StreamingAssets. It works if i add lines to my script that copy the entire database.sqlite from StreamingAssets to the PersistentDataPath of my Application but, if so, the db is public to the end user and he could modify its values. I’ve dropped in Plugins folder files like Mono.Data.dll, Mono.Data.Sqlite.dll, Mono.Data.SqlliteClient.dll, Sqlite3.dll and System.Data.dll and in Android folder i dropped libsqlite3.so…Do you think there are some problems in this compiled files?
Thank you in advance for the help…
The code that i add to let the app work on persistentDataPath is:
string dbPath = Application.persistentDataPath + "/Database/mydb.sqlite";
if (!File.Exists (dbPath)) {
WWW loadDB = new WWW (Application.streamingAssetsPath + "/Database/mydb.sqlite");
while (!loadDB.isDone) { }
File.WriteAllBytes (dbPath, loadDB.bytes);
}
connectionURI = "URI=file:" + dbPath;
using (IDbConnection dbConnection = new SqliteConnection(connectionURI)){
//aprire la connessione con il database passato come path-string
dbConnection.Open();