File tree Expand file tree Collapse file tree 3 files changed +11
-47
lines changed
app/src/main/java/com/tinkerpatch/easy_sample Expand file tree Collapse file tree 3 files changed +11
-47
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -61,15 +61,16 @@ public void attachBaseContext(Context base) {
61
61
MultiDex .install (base );
62
62
}
63
63
64
-
65
- /**
66
- * 由于在onCreate替换真正的Application,
67
- * 我们建议在onCreate初始化TinkerPatch,而不是attachBaseContext
68
- */
69
64
@ Override
70
65
public void onCreate () {
71
66
super .onCreate ();
72
- // 我们可以从这里获得Tinker加载过程的信息
67
+ initTinker ();
68
+ }
69
+
70
+ /**
71
+ * 我们需要确保至少在主进程和patch进程中初始化 TinkerPatch
72
+ */
73
+ private void initTinker () {
73
74
if (BuildConfig .TINKER_ENABLE ) {
74
75
tinkerApplicationLike = TinkerPatchApplicationLike .getTinkerPatchApplicationLike ();
75
76
@@ -82,13 +83,13 @@ public void onCreate() {
82
83
// 获取当前的补丁版本
83
84
Log .d (TAG , "current patch version is " + TinkerPatch .with ().getPatchVersion ());
84
85
85
- // 每隔3个小时去访问后台时候有更新,通过handler实现轮训的效果
86
- new FetchPatchHandler ().fetchPatchWithInterval (3 );
86
+ // 每隔3个小时去访问后台时候有更新, 通过 handler 实现轮询的效果
87
+ // 默认 setFetchPatchIntervalByHours 只是设置调用的频率限制,并没有去轮询
88
+ TinkerPatch .with ().startPoll (3 );
87
89
}
88
90
}
89
91
90
92
91
-
92
93
/**
93
94
* 在这里给出TinkerPatch的所有接口解释
94
95
* 更详细的解释请参考:http://tinkerpatch.com/Docs/api
Original file line number Diff line number Diff line change @@ -16,5 +16,5 @@ org.gradle.jvmargs=-Xmx1536m
16
16
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17
17
# org.gradle.parallel=true
18
18
19
- TINKERPATCH_VERSION =1.1.4
19
+ TINKERPATCH_VERSION =1.1.5
20
20
ANDRESGUARD_VERSION =1.2.2
You can’t perform that action at this time.
0 commit comments