|
- require("preload.Plugin")
-
- -- 安装包补丁工具
-
- -- android
- local PluginPatcher
-
- if cc.Application:getInstance():getTargetPlatform() == 3 then
- PluginPatcher = cc.PluginManager:getInstance():createPlugin("PluginPatcher" , "com/ddgame/plugin/PluginPatcher");
- elseif cc.Application:getInstance():getTargetPlatform() == 4 or cc.Application:getInstance():getTargetPlatform() == 5 then
- else
- end
-
- function getCurrentApkMd5()
- local result
- if PluginPatcher then
- result = PluginPatcher:callString("getApkMd5")
- end
- print("PluginPatcher::getCurrentApkMd5() result = ", tostring(result))
- return result
- end
-
- -- 是否支持补丁安装功能
- function isPatcherSupport()
- if cc.Application:getInstance():getTargetPlatform() == 3 then
- return true;
- else
- return false;
- end
- end
-
- -- 生成新的APK
- function patcherMakeApk(patchPath, patchMd5, newApkPath, newApkMd5)
- if PluginPatcher then
- local tt = {
- patchPath = patchPath,
- patchMd5 = patchMd5,
- newApkPath = newApkPath,
- newApkMd5 = newApkMd5,
- }
- local result = PluginPatcher:callString("makeNewApk", tt)
- print("PluginPatcher::patcherMakeApk() result = ", result)
- return result == "Successed";
- end
- return false;
- end
-
- -- 安装APK
- function patcherInstallApk(apk_file)
- if PluginPatcher then
- PluginPatcher:callVoid("installNewApk", apk_file);
- end
- end
|