com.tencent.tinker.lib.patch.UpgradePatch Java Examples

The following examples show how to use com.tencent.tinker.lib.patch.UpgradePatch. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TinkerManager.java    From HotFixDemo with MIT License 6 votes vote down vote up
/**
 * 自定义安装Tinker(使用你自定义的reporter类:SampleLoadReporter、SamplePatchReporter、SamplePatchListener、SampleResultService)
 * you can specify all class you want.
 * sometimes, you can only install tinker in some process you want!
 */
public static void installTinker(ApplicationLike appLike) {
    if (isInstalled) {
        TinkerLog.w(TAG, "install tinker, but has installed, ignore");
        return;
    }
    //or you can just use DefaultLoadReporter
    LoadReporter loadReporter = new SampleLoadReporter(appLike.getApplication());
    //or you can just use DefaultPatchReporter
    PatchReporter patchReporter = new SamplePatchReporter(appLike.getApplication());
    //or you can just use DefaultPatchListener
    PatchListener patchListener = new SamplePatchListener(appLike.getApplication());
    //you can set your own upgrade patch if you need
    AbstractPatch upgradePatchProcessor = new UpgradePatch();

    TinkerInstaller.install(appLike,
            loadReporter, patchReporter, patchListener,
            SampleResultService.class, upgradePatchProcessor);

    isInstalled = true;
}
 
Example #2
Source File: SampleTinkerManager.java    From tinker-manager with Apache License 2.0 6 votes vote down vote up
/**
     * you can specify all class you want.
     * sometimes, you can only install com.dx168.patchsdk.sample in some process you want!
     *
     * @param appLike
     */
    public static void installTinker(ApplicationLike appLike) {
        if (isInstalled) {
            TinkerLog.w(TAG, "install com.dx168.patchsdk.sample, but has installed, ignore");
            return;
        }
        //or you can just use DefaultLoadReporter
        LoadReporter loadReporter = new SampleLoadReporter(appLike.getApplication());
        //or you can just use DefaultPatchReporter
        PatchReporter patchReporter = new SamplePatchReporter(appLike.getApplication());
        //or you can just use DefaultPatchListener
        PatchListener patchListener = new SamplePatchListener(appLike.getApplication());
        //you can set your own upgrade patch if you need
//        AbstractPatch upgradePatchProcessor = new SampleUpgradePatch();
        AbstractPatch upgradePatchProcessor = new UpgradePatch();

        TinkerInstaller.install(appLike, loadReporter, patchReporter, patchListener, SampleResultService.class,
                upgradePatchProcessor);

        isInstalled = true;
    }
 
Example #3
Source File: TinkerManager.java    From tinkerpatch-sdk with MIT License 6 votes vote down vote up
/**
 * you can specify all class you want.
 * sometimes, you can only install tinker in some process you want!
 *
 * @param appLike ApplicationLike
 */
public static void installTinker(ApplicationLike appLike) {
    if (isInstalled) {
        TinkerLog.w(TAG, "install tinker, but has installed, ignore");
        return;
    }
    //or you can just use DefaultLoadReporter
    LoadReporter loadReporter = new TinkerServerLoadReporter(appLike.getApplication());
    //or you can just use DefaultPatchReporter
    PatchReporter patchReporter = new DefaultPatchReporter(appLike.getApplication());
    //or you can just use DefaultPatchListener
    PatchListener patchListener = new TinkerServerPatchListener(appLike.getApplication());
    //you can set your own upgrade patch if you need
    AbstractPatch upgradePatchProcessor = new UpgradePatch();
    TinkerInstaller.install(appLike,
        loadReporter, patchReporter, patchListener,
        TinkerServerResultService.class, upgradePatchProcessor
    );

    isInstalled = true;
}
 
Example #4
Source File: SampleApplication.java    From tinkerpatch-andresguard-sample with MIT License 5 votes vote down vote up
/**
 * 自定义Tinker类的高级用法, 一般不推荐使用
 * 更详细的解释请参考:http://tinkerpatch.com/Docs/api
 */
private void complexSample() {
    TinkerPatch.Builder builder = new TinkerPatch.Builder(tinkerApplicationLike);
    //修改tinker的构造函数,自定义类
    builder.listener(new DefaultPatchListener(this))
        .loadReporter(new DefaultLoadReporter(this))
        .patchReporter(new DefaultPatchReporter(this))
        .resultServiceClass(TinkerServerResultService.class)
        .upgradePatch(new UpgradePatch())
        .patchRequestCallback(new TinkerPatchRequestCallback());

    TinkerPatch.init(builder.build());
}
 
Example #5
Source File: SampleApplicationLike.java    From tinkerpatch-sample with MIT License 5 votes vote down vote up
/**
 * 自定义Tinker类的高级用法,一般不推荐使用
 * 更详细的解释请参考:http://tinkerpatch.com/Docs/api
 */
private void complexSample() {
    TinkerPatch.Builder builder = new TinkerPatch.Builder(this);
    //修改tinker的构造函数,自定义类
    builder.listener(new DefaultPatchListener(getApplication()))
            .loadReporter(new DefaultLoadReporter(getApplication()))
            .patchReporter(new DefaultPatchReporter(getApplication()))
            .resultServiceClass(TinkerServerResultService.class)
            .upgradePatch(new UpgradePatch())
            .patchRequestCallback(new TinkerPatchRequestCallback());

    TinkerPatch.init(builder.build());
}