I created a sqlite database from unity to run it on android, so I used Apllicantion.persistantDataPath as the path.
On pc it works very well, I can create, add, delete and modify data.
But in the device it does not work, and I didnt got any error.
public void openDB(string p)
{
connection = “URI=file:” + Application.persistentDataPath + “/” + p;
Debug.Log(connection);
dbconn = new SqliteConnection(connection);
dbconn.Open();
dbcmd = dbconn.CreateCommand();
}
public void closeDB()
{
dbcmd.Dispose();
dbcmd = null;
dbconn.Close();
dbconn = null;
}
public void saveData(string desc, int age, string wants) {
dbconn = (IDbConnection)new SqliteConnection(connection);
string sqlQuery = "INSERT INTO Dados (Descricao, Idade, Interesses) VALUES ('" + desc +"',"+ age + ",'" + wants + "')";
dbcmd.CommandText = sqlQuery;
dbcmd.ExecuteNonQuery();
}