当前位置: 首页>>代码示例>>Java>>正文


Java TinkerServiceInternals.killTinkerPatchServiceProcess方法代码示例

本文整理汇总了Java中com.tencent.tinker.lib.util.TinkerServiceInternals.killTinkerPatchServiceProcess方法的典型用法代码示例。如果您正苦于以下问题:Java TinkerServiceInternals.killTinkerPatchServiceProcess方法的具体用法?Java TinkerServiceInternals.killTinkerPatchServiceProcess怎么用?Java TinkerServiceInternals.killTinkerPatchServiceProcess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.tencent.tinker.lib.util.TinkerServiceInternals的用法示例。


在下文中一共展示了TinkerServiceInternals.killTinkerPatchServiceProcess方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPatchResult

import com.tencent.tinker.lib.util.TinkerServiceInternals; //导入方法依赖的package包/类
/**
 * we may want to use the new patch just now!!
 *
 * @param result
 */
@Override
public void onPatchResult(PatchResult result) {
    if (result == null) {
        TinkerLog.e(TAG, "DefaultTinkerResultService received null result!!!!");
        return;
    }
    TinkerLog.i(TAG, "DefaultTinkerResultService received a result:%s ", result.toString());

    //first, we want to kill the recover process
    TinkerServiceInternals.killTinkerPatchServiceProcess(getApplicationContext());

    // if success and newPatch, it is nice to delete the raw file, and restart at once
    // only main process can load an upgrade patch!
    if (result.isSuccess) {
        deleteRawPatchFile(new File(result.rawPatchFilePath));
        if (checkIfNeedKill(result)) {
            android.os.Process.killProcess(android.os.Process.myPid());
        } else {
            TinkerLog.i(TAG, "I have already install the newly patch version!");
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:DefaultTinkerResultService.java

示例2: onPatchResult

import com.tencent.tinker.lib.util.TinkerServiceInternals; //导入方法依赖的package包/类
public void onPatchResult(PatchResult result) {
    if (result == null) {
        TinkerLog.e(TAG, "DefaultTinkerResultService received null result!!!!", new Object[0]);
        return;
    }
    TinkerLog.i(TAG, "DefaultTinkerResultService received a result:%s ", result.toString());
    TinkerServiceInternals.killTinkerPatchServiceProcess(getApplicationContext());
    if (result.isSuccess && result.isUpgradePatch) {
        File rawFile = new File(result.rawPatchFilePath);
        if (rawFile.exists()) {
            TinkerLog.i(TAG, "save delete raw patch file", new Object[0]);
            SharePatchFileUtil.safeDeleteFile(rawFile);
        }
        if (checkIfNeedKill(result)) {
            Process.killProcess(Process.myPid());
        } else {
            TinkerLog.i(TAG, "I have already install the newly patch version!", new Object[0]);
        }
    }
    if (!result.isSuccess && !result.isUpgradePatch) {
        Tinker.with(getApplicationContext()).cleanPatch();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:DefaultTinkerResultService.java

示例3: onPatchResult

import com.tencent.tinker.lib.util.TinkerServiceInternals; //导入方法依赖的package包/类
@Override
public void onPatchResult(final PatchResult result) {
    if (result == null) {
        TinkerLog.e(TAG, "SampleResultService received null result!!!!");
        return;
    }
    TinkerLog.i(TAG, "SampleResultService receive result: %s", result.toString());

    //first, we want to kill the recover process
    TinkerServiceInternals.killTinkerPatchServiceProcess(getApplicationContext());

    Handler handler = new Handler(Looper.getMainLooper());
    handler.post(new Runnable() {
        @Override
        public void run() {
            if (result.isSuccess) {
                Toast.makeText(getApplicationContext(), "patch success, please restart process", Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(getApplicationContext(), "patch fail, please check reason", Toast.LENGTH_LONG).show();
            }
        }
    });
    // is success and newPatch, it is nice to delete the raw file, and restart at once
    // for old patch, you can't delete the patch file
    if (result.isSuccess) {
        deleteRawPatchFile(new File(result.rawPatchFilePath));

        //not like TinkerResultService, I want to restart just when I am at background!
        //if you have not install tinker this moment, you can use TinkerApplicationHelper api
        if (checkIfNeedKill(result)) {
            if (Utils.isBackground()) {
                TinkerLog.i(TAG, "it is in background, just restart process");
                restartProcess();
            } else {
                //we can wait process at background, such as onAppBackground
                //or we can restart when the screen off
                TinkerLog.i(TAG, "tinker wait screen to restart process");
                new ScreenState(getApplicationContext(), new ScreenState.IOnScreenOff() {
                    @Override
                    public void onScreenOff() {
                        restartProcess();
                    }
                });
            }
        } else {
            TinkerLog.i(TAG, "I have already install the newly patch version!");
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:50,代码来源:SampleResultService.java

示例4: onPatchResult

import com.tencent.tinker.lib.util.TinkerServiceInternals; //导入方法依赖的package包/类
@Override
public void onPatchResult(final PatchResult result) {
    if (result == null) {
        TinkerLog.e(TAG, "SampleResultService received null result!!!!");
        return;
    }
    TinkerLog.i(TAG, "SampleResultService receive result: %s", result.toString());

    //first, we want to kill the recover process
    TinkerServiceInternals.killTinkerPatchServiceProcess(getApplicationContext());

    Handler handler = new Handler(Looper.getMainLooper());
    handler.post(new Runnable() {
        @Override
        public void run() {
            if (result.isSuccess) {
                Toast.makeText(getApplicationContext(), "patch success, please restart process", Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(getApplicationContext(), "patch fail, please check reason", Toast.LENGTH_LONG).show();
            }
        }
    });
    // is success and newPatch, it is nice to delete the raw file, and restart at once
    // for old patch, you can't delete the patch file
    if (result.isSuccess) {
        deleteRawPatchFile(new File(result.rawPatchFilePath));

        //not like TinkerResultService, I want to restart just when I am at background!
        //if you have not install tinker this moment, you can use TinkerApplicationHelper api
        if (checkIfNeedKill(result)) {
            if (Utils.isBackground()) {
                TinkerLog.i(TAG, "it is in background, just restart process");
                restartProcess();
            } else {
                //we can wait process at background, such as onAppBackground
                //or we can restart when the screen off
                TinkerLog.i(TAG, "tinker wait screen to restart process");
                new Utils.ScreenState(getApplicationContext(), new Utils.ScreenState.IOnScreenOff() {
                    @Override
                    public void onScreenOff() {
                        restartProcess();
                    }
                });
            }
        } else {
            TinkerLog.i(TAG, "I have already install the newly patch version!");
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:50,代码来源:SampleResultService.java

示例5: onPatchResult

import com.tencent.tinker.lib.util.TinkerServiceInternals; //导入方法依赖的package包/类
public void onPatchResult(final PatchResult result) {
    if (result == null) {
        TinkerLog.e(TAG, "SampleResultService received null result!!!!", new Object[0]);
        return;
    }
    TinkerLog.i(TAG, "SampleResultService receive result: %s", result.toString());
    TinkerServiceInternals.killTinkerPatchServiceProcess(getApplicationContext());
    new Handler(Looper.getMainLooper()).post(new Runnable() {
        public void run() {
            if (result.isSuccess) {
                MobclickAgent.onEvent(MyApplication.getContext(), Event.tinker_combine_success);
                Helper.showLog(OneTinkerResultService.TAG, "patch success, please restart " +
                        "process");
                return;
            }
            MobclickAgent.onEvent(MyApplication.getContext(), Event.tinker_combine_failed);
            Helper.showLog(OneTinkerResultService.TAG, "patch fail, please check reason");
        }
    });
    if (result.isSuccess && result.isUpgradePatch) {
        File rawFile = new File(result.rawPatchFilePath);
        if (rawFile.exists()) {
            TinkerLog.i(TAG, "save delete raw patch file", new Object[0]);
            SharePatchFileUtil.safeDeleteFile(rawFile);
        }
        if (!checkIfNeedKill(result)) {
            TinkerLog.i(TAG, "I have already install the newly patch version!", new Object[0]);
        } else if (Utils.isBackground()) {
            TinkerLog.i(TAG, "it is in background, just restart process", new Object[0]);
            restartProcess();
        } else {
            TinkerLog.i(TAG, "tinker wait screen to restart process", new Object[0]);
            ScreenState screenState = new ScreenState(getApplicationContext(), new
                    IOnScreenOff() {
                public void onScreenOff() {
                    OneTinkerResultService.this.restartProcess();
                }
            });
        }
    }
    if (!result.isSuccess && !result.isUpgradePatch) {
        Tinker.with(getApplicationContext()).cleanPatch();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:45,代码来源:OneTinkerResultService.java

示例6: onPatchResult

import com.tencent.tinker.lib.util.TinkerServiceInternals; //导入方法依赖的package包/类
@Override
public void onPatchResult(final PatchResult result) {
    if (result == null) {
        TinkerLog.e(TAG, "SampleResultService received null result!!!!");
        return;
    }
    TinkerLog.i(TAG, "SampleResultService receive result: %s", result.toString());

    //first, we want to kill the recover process
    TinkerServiceInternals.killTinkerPatchServiceProcess(getApplicationContext());

    Handler handler = new Handler(Looper.getMainLooper());
    handler.post(new Runnable() {
        @Override
        public void run() {
            if (result.isSuccess) {
                Toast.makeText(getApplicationContext(), "patch success, please restart process", Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(getApplicationContext(), "patch fail, please check reason", Toast.LENGTH_LONG).show();
            }
        }
    });
    // is success and newPatch, it is nice to delete the raw file, and restart at once
    // for old patch, you can't delete the patch file
    if (result.isSuccess) {
        deleteRawPatchFile(new File(result.rawPatchFilePath));

        //not like TinkerResultService, I want to restart just when I am at background!
        //if you have not install tinker this moment, you can use TinkerApplicationHelper api
        if (checkIfNeedKill(result)) {
            if (TinkerUtils.isBackground()) {
                TinkerLog.i(TAG, "it is in background, just restart process");
                restartProcess();
            } else {
                //we can wait process at background, such as onAppBackground
                //or we can restart when the screen off
                TinkerLog.i(TAG, "tinker wait screen to restart process");
                new TinkerUtils.ScreenState(getApplicationContext(), new TinkerUtils.ScreenState.IOnScreenOff() {
                    @Override
                    public void onScreenOff() {
                        restartProcess();
                    }
                });
            }
        } else {
            TinkerLog.i(TAG, "I have already install the newly patch version!");
        }
    }
}
 
开发者ID:GitLqr,项目名称:HotFixDemo,代码行数:50,代码来源:SampleResultService.java

示例7: onPatchResult

import com.tencent.tinker.lib.util.TinkerServiceInternals; //导入方法依赖的package包/类
@Override
public void onPatchResult(final PatchResult result) {
    if (result == null) {
        TinkerLog.e(TAG, "SampleResultService received null result!!!!");
        return;
    }
    TinkerLog.i(TAG, "SampleResultService receive result: %s", result.toString());

    //first, we want to kill the recover process
    TinkerServiceInternals.killTinkerPatchServiceProcess(getApplicationContext());

    Handler handler = new Handler(Looper.getMainLooper());
    handler.post(new Runnable() {
        @Override
        public void run() {
            if (result.isSuccess) {
                TinkerLog.i(TAG, "patch success, please restart process");
            } else {
                TinkerLog.e(TAG, "patch fail, please check reason");
            }
        }
    });
    // is success and newPatch, it is nice to delete the raw file, and restart at once
    // for old patch, you can't delete the patch file
    if (!result.isSuccess) {
        //补丁合成异常
        PatchManager.getInstance().onPatchFailure(result.rawPatchFilePath, PatchManager.ERROR_CODE_PATCH_RESULT + PatchManager.ERROR_PATCH_FAIL);
        return;
    }
    //deleteRawPatchFile(new File(result.rawPatchFilePath));

    PatchManager.getInstance().onPatchSuccess(result.rawPatchFilePath);

    //not like TinkerResultService, I want to restart just when I am at background!
    //if you have not install tinker this moment, you can use TinkerApplicationHelper api
    if (checkIfNeedKill(result)) {
        if (SampleUtils.isBackground()) {
            TinkerLog.i(TAG, "it is in background, just restart process");
            restartProcess();
        } else {
            //we can wait process at background, such as onAppBackground
            //or we can restart when the screen off
            TinkerLog.i(TAG, "tinker wait screen to restart process");
            new SampleUtils.ScreenState(getApplicationContext(), new SampleUtils.ScreenState.IOnScreenOff() {
                @Override
                public void onScreenOff() {
                    restartProcess();
                }
            });
        }
    } else {
        TinkerLog.i(TAG, "I have already install the newly patch version!");
    }
}
 
开发者ID:baidao,项目名称:tinker-manager,代码行数:55,代码来源:SampleResultService.java

示例8: onPatchResult

import com.tencent.tinker.lib.util.TinkerServiceInternals; //导入方法依赖的package包/类
@Override
public void onPatchResult(final PatchResult result) {
    if (result == null) {
        TinkerLog.e(TAG, "received null result!!!!");
        return;
    }
    TinkerLog.i(TAG, "receive result: %s", result.toString());

    //first, we want to kill the recover process
    TinkerServiceInternals.killTinkerPatchServiceProcess(getApplicationContext());
    TinkerServerManager.reportTinkerPatchFail(result);

    if (result.isSuccess) {
        TinkerLog.i(TAG, "patch success, please restart process");
        File rawFile = new File(result.rawPatchFilePath);
        if (rawFile.exists()) {
            TinkerLog.i(TAG, "save delete raw patch file");
            SharePatchFileUtil.safeDeleteFile(rawFile);
        }
        //not like TinkerResultService, I want to restart just when I am at background!
        //if you have not install tinker this moment, you can use TinkerApplicationHelper api
        if (checkIfNeedKill(result)) {
            if (TinkerServerUtils.isBackground()) {
                TinkerLog.i(TAG, "it is in background, just restart process");
                restartProcess();
            } else {
                //we can wait process at background, such as onAppBackground
                //or we can restart when the screen off
                TinkerLog.i(TAG, "tinker wait screen to restart process");
                new TinkerServerUtils.ScreenState(
                    getApplicationContext(), new TinkerServerUtils.IOnScreenOff() {
                    @Override
                    public void onScreenOff() {
                        restartProcess();
                    }
                });
            }
        } else {
            TinkerLog.i(TAG, "I have already install the newly patch version!");
        }
    } else {
        TinkerLog.i(TAG, "patch fail, please check reason");
    }

    //repair current patch fail, just clean!
    if (!result.isSuccess) {
        //if you have not install tinker this moment, you can use TinkerApplicationHelper api
        Tinker.with(getApplicationContext()).cleanPatch();
    }
}
 
开发者ID:TinkerPatch,项目名称:tinkerpatch-sdk,代码行数:51,代码来源:TinkerServerResultService.java


注:本文中的com.tencent.tinker.lib.util.TinkerServiceInternals.killTinkerPatchServiceProcess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。