各位前輩們好
小弟目前為新手正在努力自學中
最近自己使用Unity製作了一個Android小遊戲, 想要讓它自動更新
伺服器部分處理完了, 也可以下載檔案
也做了檔案下載進度條
但.....下載完後卻打不開(囧)
試過了許多的方法, 也在外文網查了許多文章
但都沒用...... >_<
懇求各位前輩幫忙!
(Player的Write Access 為 External(SD Card))
//ServerFileName為檔案的名稱 ex:test.apk
string filePath= Application.persistentDataPath + "/" + ServerFileName;
查出來的確切路徑為:
/storage/emulated/0/android/data/com.mygame/files/
....
using System.IO;
using System.Diagnostics;
....
//寫入檔案
System.IO.FileInfo file = new System.IO.FileInfo(filePath);
file.Directory.Create();
//下載用www方式
System.IO.File.WriteAllBytes(filePath, www.bytes);
開啟檔案使用過的方法為: