Unity5 Android Exporting - Different behaviours on different devices
I have some issues on exporting .apk file from Unity5.
I can build apks succesfully, but on runtime something goes different depends on devices i'm using. Here's the thing:
I have Sqlite database called "guess.bytes". On Samsung devices(Android 6.0.1 and Android 4.1), it works perfectly. But on Lenovo K6 Note device(Android 6.0.1) cant find the database path(I think) 'cause i'm getting "Database is not open" error.
I'm using StreamingAssets folder to keep database. And here's my code:
public void connection()
{
try
{
if (Application.platform != RuntimePlatform.Android)
{
path = Application.dataPath + "/guess.bytes";
}
else
{
path = Application.persistentDataPath + "/guess.bytes";
if (!File.Exists(path))
{
WWW load = new WWW("jar:file://" + Application.dataPath + "!/assets/" + "guess.bytes");
while (!load.isDone) { }
File.WriteAllBytes(path, load.bytes);
}
}
db_con = new SqliteConnection("URI=file:" + path);
db_con.Open();
if (db_con.State == ConnectionState.Open)
{
txtRes.text = path.ToString() + " - Connected";
}
}
catch (Exception ex)
{
txtRes.text = ex.Message;
}
}
Comment
Your answer
