Comments (2)
Does it work on Linux too..?
from sqliteforunity.
A little late, but I may have an answer. Maybe it can be useful for future users.
The problem is that the example copies the 'default' database (located in StreamingAssets) in the new location on the phone, but that database was crated in the Editor mode and it may be not read correctly on mobile devices, especially if it is encrypted.
The solution is to directly create a new database in the new position. I show a piece of my code:
private ISQLiteConnection _connection;
private DatabaseController()
{
// We check the existance of the database. If it does not exists we create a new one.
var factory = new ConnectionFactory();
// check if file exists in Application.persistentDataPath
filepath = string.Format("{0}/{1}", Application.persistentDataPath, DatabaseName);
if (!File.Exists(filepath))
{
// Creating new database
Debug.Log("Database not in Persistent path: creating new one");
_connection = factory.Create(filepath);
CreateScoreTable();
LockDB();
Debug.Log("Database written in " + filepath);
}
else {
dbPath = filepath;
firstCreation = false;
_connection = factory.Create(dbPath);
}
Debug.Log("Database succesfully load");
}
/// <summary>
/// Creating the score table. Method to use when we have created a new database.
/// </summary>
public void CreateScoreTable()
{
_connection.CreateTable<YourTable>();
}
/// <summary>
/// Encripts the database
/// </summary>
public void LockDB()
{
_connection.SetDbKey(Password);
}`
from sqliteforunity.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqliteforunity.