コード例 #1
0
  /**
   * you can specify all class you want. sometimes, you can only install tinker in some process you
   * want!
   *
   * @param appLike
   */
  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();
    // you can set your own repair patch if you need
    AbstractPatch repairPatchProcessor = new RepairPatch();

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

    isInstalled = true;
  }
コード例 #2
0
 public static void setUpgradeRetryEnable(boolean enable) {
   UpgradePatchRetry.getInstance(applicationLike.getApplication()).setRetryEnable(enable);
 }