本文整理汇总了Java中com.tencent.tinker.lib.tinker.TinkerInstaller类的典型用法代码示例。如果您正苦于以下问题:Java TinkerInstaller类的具体用法?Java TinkerInstaller怎么用?Java TinkerInstaller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TinkerInstaller类属于com.tencent.tinker.lib.tinker包,在下文中一共展示了TinkerInstaller类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: installTinker
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
/**
* 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();
TinkerInstaller.install(appLike,
loadReporter, patchReporter, patchListener,
SampleResultService.class, upgradePatchProcessor);
isInstalled = true;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:TinkerManager.java
示例2: onBaseContextAttached
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
/**
* install multiDex before install tinker
* so we don't need to put the tinker lib classes in the main dex
*
* @param base
*/
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void onBaseContextAttached(Context base) {
super.onBaseContextAttached(base);
sContext = getApplication();
//you must install multiDex whatever tinker is installed!
MultiDex.install(base);
TinkerManager.setTinkerApplicationLike(this);
TinkerManager.initFastCrashProtect();
//should set before tinker is installed
TinkerManager.setUpgradeRetryEnable(true);
//optional set logIml, or you can use default debug log
TinkerInstaller.setLogIml(new MyLogImp());
//installTinker after load multiDex
//or you can put com.tencent.tinker.** to main dex
TinkerManager.installTinker(this);
Tinker tinker = Tinker.with(getApplication());
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:AndroidApplication.java
示例3: onBaseContextAttached
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
/**
* install multiDex before install tinker
* so we don't need to put the tinker lib classes in the main dex
*
* @param base
*/
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void onBaseContextAttached(Context base) {
super.onBaseContextAttached(base);
//you must install multiDex whatever tinker is installed!
MultiDex.install(base);
SampleApplicationContext.application = getApplication();
SampleApplicationContext.context = getApplication();
TinkerManager.setTinkerApplicationLike(this);
TinkerManager.initFastCrashProtect();
//should set before tinker is installed
TinkerManager.setUpgradeRetryEnable(true);
//optional set logIml, or you can use default debug log
TinkerInstaller.setLogIml(new MyLogImp());
//installTinker after load multiDex
//or you can put com.tencent.tinker.** to main dex
TinkerManager.installTinker(this);
Tinker tinker = Tinker.with(getApplication());
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:SampleApplicationLike.java
示例4: retryPatch
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
public boolean retryPatch() {
final Tinker tinker = Tinker.with(context);
if (!tinker.isMainProcess()) {
return false;
}
File patchVersionFile = tinker.getTinkerLoadResultIfPresent().patchVersionFile;
if (patchVersionFile != null) {
if (UpgradePatchRetry.getInstance(context).onPatchListenerCheck(SharePatchFileUtil.getMD5(patchVersionFile))) {
TinkerLog.i(TAG, "try to repair oat file on patch process");
TinkerInstaller.onReceiveUpgradePatch(context, patchVersionFile.getAbsolutePath());
return true;
}
// else {
// TinkerLog.i(TAG, "repair retry exceed must max time, just clean");
// checkAndCleanPatch();
// }
}
return false;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:DefaultLoadReporter.java
示例5: onBaseContextAttached
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void onBaseContextAttached(Context base) {
super.onBaseContextAttached(base);
//you must install multiDex whatever tinker is installed!
MultiDex.install(base);
SampleApplicationContext.application = getApplication();
SampleApplicationContext.context = getApplication();
TinkerManager.setTinkerApplicationLike(this);
TinkerManager.initFastCrashProtect();
TinkerManager.setUpgradeRetryEnable(true);
TinkerInstaller.setLogIml(new MyLogImp());
TinkerManager.installTinker(this);
}
开发者ID:xingstarx,项目名称:TinkerDemo,代码行数:19,代码来源:BaseApplicationLike.java
示例6: onLoadFileNotFound
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
public void onLoadFileNotFound(File file, int fileType, boolean isDirectory) {
TinkerLog.i(TAG, "patch file not found: %s, fileType:%d, isDirectory:%b", file
.getAbsolutePath(), Integer.valueOf(fileType), Boolean.valueOf(isDirectory));
if (fileType == 3 || fileType == 5 || fileType == 6 || fileType == 7) {
Tinker tinker = Tinker.with(this.context);
if (!tinker.isPatchProcess()) {
File patchVersionFile = tinker.getTinkerLoadResultIfPresent().patchVersionFile;
if (patchVersionFile != null) {
TinkerInstaller.onReceiveRepairPatch(this.context, patchVersionFile
.getAbsolutePath());
}
}
} else if (fileType == 1 || fileType == 2) {
Tinker.with(this.context).cleanPatch();
}
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:17,代码来源:DefaultLoadReporter.java
示例7: onLoadPatchListenerReceiveFail
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
public void onLoadPatchListenerReceiveFail(final File patchFile, int errorCode, boolean
isUpgrade) {
super.onLoadPatchListenerReceiveFail(patchFile, errorCode, isUpgrade);
switch (errorCode) {
case -6:
MobclickAgent.onEvent(MyApplication.getContext(), Event.tinker_error_no_space);
break;
case -3:
if (isUpgrade) {
this.handler.postDelayed(new Runnable() {
public void run() {
TinkerInstaller.onReceiveUpgradePatch(SampleLoadReporter.this
.context, patchFile.getAbsolutePath());
}
}, 60000);
break;
}
break;
case -2:
MobclickAgent.onEvent(MyApplication.getContext(), Event.tinker_error_patch_noexits);
break;
}
SampleTinkerReport.onTryApplyFail(errorCode);
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:SampleLoadReporter.java
示例8: onPatchRetryLoad
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
public void onPatchRetryLoad() {
if (!this.isRetryEnable) {
TinkerLog.w(TAG, "onPatchRetryLoad retry disabled, just return", new Object[0]);
} else if (!Tinker.with(this.context).isMainProcess()) {
TinkerLog.w(TAG, "onPatchRetryLoad retry is not main process, just return", new
Object[0]);
} else if (!this.retryInfoFile.exists()) {
TinkerLog.w(TAG, "onPatchRetryLoad retry info not exist, just return", new Object[0]);
} else if (TinkerServiceInternals.isTinkerPatchServiceRunning(this.context)) {
TinkerLog.w(TAG, "onPatchRetryLoad tinker service is running, just return", new
Object[0]);
} else {
String path = this.tempPatchFile.getAbsolutePath();
if (path == null || !new File(path).exists()) {
TinkerLog.w(TAG, "onPatchRetryLoad patch file: %s is not exist, just return", path);
return;
}
TinkerLog.w(TAG, "onPatchRetryLoad patch file: %s is exist, retry to patch", path);
TinkerInstaller.onReceiveUpgradePatch(this.context, path);
SampleTinkerReport.onReportRetryPatch();
}
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:UpgradePatchRetry.java
示例9: installTinker
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
/**
* 自定义安装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;
}
开发者ID:GitLqr,项目名称:HotFixDemo,代码行数:26,代码来源:TinkerManager.java
示例10: installTinker
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
/**
* 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;
}
开发者ID:baidao,项目名称:tinker-manager,代码行数:27,代码来源:SampleTinkerManager.java
示例11: onBaseContextAttached
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
/**
* install multiDex before install com.dx168.patchsdk.sample
* so we don't need to put the com.dx168.patchsdk.sample lib classes in the main dex
*
* @param base
*/
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void onBaseContextAttached(Context base) {
super.onBaseContextAttached(base);
//you must install multiDex whatever com.dx168.patchsdk.sample is installed!
MultiDex.install(base);
SampleTinkerManager.setTinkerApplicationLike(this);
SampleTinkerManager.initFastCrashProtect();
//should set before com.dx168.patchsdk.sample is installed
SampleTinkerManager.setUpgradeRetryEnable(true);
//optional set logIml, or you can use default debug log
TinkerInstaller.setLogIml(new SampleTinkerLog());
//installTinker after load multiDex
//or you can put com.tencent.com.dx168.patchsdk.sample.** to main dex
SampleTinkerManager.installTinker(this);
}
开发者ID:baidao,项目名称:tinker-manager,代码行数:26,代码来源:SampleApplicationLike.java
示例12: installTinker
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
/**
* 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;
}
开发者ID:TinkerPatch,项目名称:tinkerpatch-sdk,代码行数:27,代码来源:TinkerManager.java
示例13: handlePatchFile
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
private boolean handlePatchFile(Context context, Integer version, File patchFile) {
SharedPreferences sp = context.getSharedPreferences(
TinkerServerClient.SHARE_SERVER_PREFERENCE_CONFIG, Context.MODE_PRIVATE
);
int current = sp.getInt(TINKER_RETRY_PATCH, 0);
if (current >= TINKER_MAX_RETRY_COUNT) {
SharePatchFileUtil.safeDeleteFile(patchFile);
sp.edit().putInt(TINKER_RETRY_PATCH, 0).commit();
TinkerLog.w(TAG,
"beforePatchRequest, retry patch install more than %d times, version: %d, patch:%s",
current, version, patchFile.getPath()
);
} else {
TinkerLog.w(TAG, "beforePatchRequest, have pending patch to install, version: %d, patch:%s",
version, patchFile.getPath()
);
sp.edit().putInt(TINKER_RETRY_PATCH, ++current).commit();
TinkerInstaller.onReceiveUpgradePatch(context, patchFile.getAbsolutePath());
return true;
}
return false;
}
开发者ID:TinkerPatch,项目名称:tinkerpatch-sdk,代码行数:24,代码来源:TinkerServerPatchRequestCallback.java
示例14: tryPatchFile
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
private void tryPatchFile(File patchFile, Integer newVersion) {
TinkerServerClient client = TinkerServerClient.get();
Context context = client.getContext();
//In order to calculate the user number, just report success here
String patchMd5 = SharePatchFileUtil.getMD5(patchFile);
//update version
client.updateTinkerVersion(newVersion, patchMd5);
//delete old patch sever file
File serverDir = ServerUtils.getServerDirectory(context);
if (serverDir != null) {
File[] files = serverDir.listFiles();
if (files != null) {
String currentName = patchFile.getName();
for (File file : files) {
String fileName = file.getName();
if (fileName.equals(currentName) || fileName.equals(ServerUtils.TINKER_VERSION_FILE)) {
continue;
}
SharePatchFileUtil.safeDeleteFile(file);
}
}
client.reportPatchApplySuccess(newVersion);
//try install
TinkerInstaller.onReceiveUpgradePatch(context, patchFile.getAbsolutePath());
}
}
开发者ID:TinkerPatch,项目名称:tinkerpatch-sdk,代码行数:27,代码来源:DefaultPatchRequestCallback.java
示例15: onLoadFileNotFound
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
/**
* try to recover patch oat file
* @param file
* @param fileType
* @param isDirectory
*/
@Override
public void onLoadFileNotFound(File file, int fileType, boolean isDirectory) {
TinkerLog.i(TAG, "patch loadReporter onLoadFileNotFound: patch file not found: %s, fileType:%d, isDirectory:%b",
file.getAbsolutePath(), fileType, isDirectory);
// only try to recover opt file
// check dex opt file at last, some phone such as VIVO/OPPO like to change dex2oat to interpreted
if (fileType == ShareConstants.TYPE_DEX_OPT) {
Tinker tinker = Tinker.with(context);
//we can recover at any process except recover process
if (tinker.isMainProcess()) {
File patchVersionFile = tinker.getTinkerLoadResultIfPresent().patchVersionFile;
if (patchVersionFile != null) {
if (UpgradePatchRetry.getInstance(context).onPatchListenerCheck(SharePatchFileUtil.getMD5(patchVersionFile))) {
TinkerLog.i(TAG, "try to repair oat file on patch process");
TinkerInstaller.onReceiveUpgradePatch(context, patchVersionFile.getAbsolutePath());
} else {
TinkerLog.i(TAG, "repair retry exceed must max time, just clean");
checkAndCleanPatch();
}
}
}
} else {
checkAndCleanPatch();
}
SampleTinkerReport.onLoadFileNotFound(fileType);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:34,代码来源:SampleLoadReporter.java
示例16: sampleInstallTinker
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
/**
* all use default class, simply Tinker install method
*/
public static void sampleInstallTinker(ApplicationLike appLike) {
if (isInstalled) {
TinkerLog.w(TAG, "install tinker, but has installed, ignore");
return;
}
TinkerInstaller.install(appLike);
isInstalled = true;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:TinkerManager.java
示例17: onPatchRetryLoad
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
public void onPatchRetryLoad() {
if (!isRetryEnable) {
TinkerLog.w(TAG, "onPatchRetryLoad retry disabled, just return");
return;
}
Tinker tinker = Tinker.with(context);
//only retry on main process
if (!tinker.isMainProcess()) {
TinkerLog.w(TAG, "onPatchRetryLoad retry is not main process, just return");
return;
}
if (!retryInfoFile.exists()) {
TinkerLog.w(TAG, "onPatchRetryLoad retry info not exist, just return");
return;
}
if (TinkerServiceInternals.isTinkerPatchServiceRunning(context)) {
TinkerLog.w(TAG, "onPatchRetryLoad tinker service is running, just return");
return;
}
//must use temp file
String path = tempPatchFile.getAbsolutePath();
if (path == null || !new File(path).exists()) {
TinkerLog.w(TAG, "onPatchRetryLoad patch file: %s is not exist, just return", path);
return;
}
TinkerLog.w(TAG, "onPatchRetryLoad patch file: %s is exist, retry to patch", path);
TinkerInstaller.onReceiveUpgradePatch(context, path);
SampleTinkerReport.onReportRetryPatch();
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:32,代码来源:UpgradePatchRetry.java
示例18: onPatchRetryLoad
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
public boolean onPatchRetryLoad() {
if (!isRetryEnable) {
TinkerLog.w(TAG, "onPatchRetryLoad retry disabled, just return");
return false;
}
Tinker tinker = Tinker.with(context);
//only retry on main process
if (!tinker.isMainProcess()) {
TinkerLog.w(TAG, "onPatchRetryLoad retry is not main process, just return");
return false;
}
if (!retryInfoFile.exists()) {
TinkerLog.w(TAG, "onPatchRetryLoad retry info not exist, just return");
return false;
}
if (TinkerServiceInternals.isTinkerPatchServiceRunning(context)) {
TinkerLog.w(TAG, "onPatchRetryLoad tinker service is running, just return");
return false;
}
//must use temp file
String path = tempPatchFile.getAbsolutePath();
if (path == null || !new File(path).exists()) {
TinkerLog.w(TAG, "onPatchRetryLoad patch file: %s is not exist, just return", path);
return false;
}
TinkerLog.w(TAG, "onPatchRetryLoad patch file: %s is exist, retry to patch", path);
TinkerInstaller.onReceiveUpgradePatch(context, path);
return true;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:32,代码来源:UpgradePatchRetry.java
示例19: handleData
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
private static void handleData(Context context, JSONObject object) {
if (object != null) {
try {
patchVersion = object.optString("patch_version");
patchUrl = object.optString("download_url");
String hashValue = object.optString("hash_value");
if (!TextUtils.isEmpty(patchVersion)) {
if (TextUtils.equals(patchVersion, BuildInfo.ONE_PATCH_VERSION)) {
Helper.showLog(TAG, "patch version : " + patchVersion + " is already be " +
"patched! just return!");
return;
}
patchFile = new File(patchDir, getPatchName());
if (!patchFile.exists() || patchFile.length() <= 0) {
downloadPatch(context);
return;
}
Helper.showLog(TAG, "patch version : " + patchVersion + "is already download!" +
" just load it!");
TinkerInstaller.onReceiveUpgradePatch(MyApplication.getContext(), patchFile
.getAbsolutePath());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:28,代码来源:PatchHelper.java
示例20: sampleInstallTinker
import com.tencent.tinker.lib.tinker.TinkerInstaller; //导入依赖的package包/类
public static void sampleInstallTinker(ApplicationLike appLike) {
if (isInstalled) {
TinkerLog.w(TAG, "install tinker, but has installed, ignore", new Object[0]);
return;
}
TinkerInstaller.install(appLike);
isInstalled = true;
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:TinkerManager.java
注:本文中的com.tencent.tinker.lib.tinker.TinkerInstaller类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论