- Home /
Download updated apk and then install in andriod
I am trying to download new updated apk from my website if available and then install it using Unity to override my already installed game. I can download apk in memory card of user using following code .
private IEnumerator TestDownload()
{
WWW www = new WWW("http://192.168.1.6/file_drop/app.apk");
//yield return www;
while (!www.isDone) {
progress = "downloaded " + (www.progress*100).ToString() + "%...";
yield return null;
}
string fullPath = Application.persistentDataPath + "/app.apk";
File.WriteAllBytes (fullPath, www.bytes);
...
}
Now is there anyway to run this downloaded file form unity script so it start installing ?
Answer by SquigglyFrog · Oct 12, 2018 at 05:38 PM
Not an answer and I honestly don't know the answer to this question, but I would assume there is not as that would be a HUMONGOUS security risk.. Imagine installing a game that can download whatever apk it wants, virus / malware or whatever and just install it itself? I'm sure there are ways to do this anyways, but.. As a user, if an app had that ability and I knew about it, it would never get installed on my devices. Going to follow this just to find out if anyone has an answer..