I've got simple app, and it works fine on my PC. But on my Android-Testing Device it can not work properly. Something wrong with the paths. For Android I'm using the code to get files I want to read/write from StreamingAssets to Application.persistentDataPath:
void Awake(){if (firstWord == "Adroid" || deviceType == "Handheld")
{
StartCoroutine("Downloader");
}
}
IEnumerator Downloader()
{
WWW wwwDD = new WWW("jar:file://" + Application.dataPath + "!/assets/DropDown.xml");
yield return wwwDD;
if (wwwDD.isDone == true)
{
File.WriteAllBytes(Application.persistentDataPath + "/DropDown.xml", wwwDD.bytes);
}
WWW www1st = new WWW("jar:file://" + Application.dataPath + "!/assets/1st.xml");
yield return www1st;
if (www1st.isDone == true)
{
File.WriteAllBytes(Application.persistentDataPath + "/1st.xml", www1st.bytes);
}
WWW wwwDefault = new WWW("jar:file://" + Application.dataPath + "!/assets/Default.xml");
yield return wwwDefault;
if (wwwDefault.isDone == true)
{
File.WriteAllBytes(Application.persistentDataPath + "/Default.xml", wwwDefault.bytes);
}
}
And in logcat I've got error:
UnauthorizedAccessException: Access to the path '/data/data/<my project>/files/' is denied.
Write Access is set to Internal, and if I change it to External and add to AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
I get the same problem.
What am I doing wrong? Please tell me, I haven't sleep for about a week trying to solve this