- Home /
Question by
vjohnree25 · Dec 17, 2018 at 10:29 PM ·
android buildpathfindingdatabasesqlite
What's wrong with my script?
I have here my script for getting the path of my database in both android and Editor. But in android, it seems that the database doesn't found .
string p = "solrun_DB.db";
if (Application.platform != RuntimePlatform.Android)
{
conn = "URI=file:" + Application.dataPath + "/StreamingAssets/solrun_DB.s3db";
}
else
{
conn = "URI=file:" + Application.persistentDataPath + "/" + p;
if (!File.Exists(conn))
{
WWW load = new WWW("jar:file://" + Application.persistentDataPath + "/" + p);
while (!load.isDone) { }
File.WriteAllBytes(conn, load.bytes);
}
else
{
createDB();
}
}
Comment
Don't forget, if you don't check the request SD Storage Permissions on Android, you will be unable to access the storage system at all.
Answer by rossadamsm · Dec 18, 2018 at 02:57 PM
Hi,
I'm not sure if this helps but my file path looks like this and seems to work ok on android devices
filePath= Path.Combine("file:///" +Application.persistentDataPath,"myFile.json");
WWW reader = new WWW(filePath);
Your answer
