Java Code Examples for com.tencent.tinker.lib.tinker.TinkerInstaller#install()

The following examples show how to use com.tencent.tinker.lib.tinker.TinkerInstaller#install() . 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: TinkerManager.java    From HotFixDemo with MIT License 5 votes vote down vote up
/**
 * 默认安装Tinker(使用默认的reporter类:DefaultLoadReporter、DefaultPatchReporter、DefaultPatchListener、DefaultTinkerResultService)
 * 如果你不需要对监听app打补丁的情况(如:当打补丁失败时上传失败信息),则使用该方法
 */
public static void sampleInstallTinker(ApplicationLike appLike) {
    if (isInstalled) {
        TinkerLog.w(TAG, "install tinker, but has installed, ignore");
        return;
    }
    TinkerInstaller.install(appLike);
    isInstalled = true;

}
 
Example 5
Source File: SampleTinkerManager.java    From tinker-manager with Apache License 2.0 5 votes vote down vote up
/**
 * all use default class, simply Tinker install method
 */
public static void sampleInstallTinker(ApplicationLike appLike) {
    if (isInstalled) {
        TinkerLog.w(TAG, "install com.dx168.patchsdk.sample, but has installed, ignore");
        return;
    }
    TinkerInstaller.install(appLike);
    isInstalled = true;

}