Example #1
0
        void GenerateNewClient()
        {
            string newApk    = Application.persistentDataPath + "/" + _targetVersion + "_game.apk";
            string patchPath = Application.persistentDataPath + "/" + _targetVersion + "_" + _targetMd5 + ".patch";

            if (!File.Exists(patchPath))
            {
                _currentProgress.TotalSize = 50000;
                ChangeCurrentUpdateState(UpdateState.DownloadNewClient);
                return;
            }
            int res = AndroidInstallApk.GreateNewApk(newApk, patchPath);

            File.Delete(patchPath);
            if (res == 0)
            {
                if (FileHelper.GetFileMd5(newApk) == _targetMd5)
                {
                    ChangeCurrentUpdateState(UpdateState.InstallNewClient);
                }
                else
                {
                    if (File.Exists(newApk))
                    {
                        File.Delete(newApk);
                    }
                    _onShowUpdateStepFail(100);
                }
            }
            else
            {
                if (File.Exists(newApk))
                {
                    File.Delete(newApk);
                }
                _onShowUpdateStepFail(res);
            }
        }
Example #2
0
 void InstallNewClient()
 {
     AndroidInstallApk.InstallApk(Application.persistentDataPath + "/" + _targetVersion + "_game.apk");
 }