当前位置:网站首页>Learning 4 of workmanager
Learning 4 of workmanager
2022-07-21 06:52:00 【Mr_ Tony】
List of articles
One 、 Preface
This paper deals with WorkManager
Advanced use of – Custom configuration and initialization are recorded .
Two 、 initialization
The previous use will make WorkManager
Initialize when the program starts . If the program is only used at a certain time WorkManager
Words , It will cause unnecessary performance loss . Therefore, on-demand initialization can be used here .
1、 Remove the default initialization configuration
This article only records WorkManager2.6
The way after that
a、 Remove the attached startup
function
because WorkManager2.6
After that, it is integrated by default startup
function , So if this function is not used in the application , You can remove it in the following ways
<!-- If you want to disable android.startup completely. -->
<provider android:name="androidx.startup.InitializationProvider" android:authorities="${applicationId}.androidx-startup" tools:node="remove">
</provider>
b、 Advance and remove workmanager
function
If you just want to remove WorkManager
function , You can use the following
<provider android:name="androidx.startup.InitializationProvider" android:authorities="${applicationId}.androidx-startup" android:exported="false" tools:node="merge">
<!-- If you are using androidx.startup to initialize other components -->
<meta-data android:name="androidx.work.WorkManagerInitializer" android:value="androidx.startup" tools:node="remove" />
</provider>
3、 ... and 、 Custom configuration
After removing the default configuration , Custom configuration is required , Related code examples are as follows :
class MyApplication() : Application(), Configuration.Provider {
override fun getWorkManagerConfiguration() =
Configuration.Builder()
.setMinimumLoggingLevel(android.util.Log.INFO)
.build()
}
For the time being, this series ends , Other functions will be updated again if they are used in the work
Four 、 Reference link
边栏推荐
- “我放弃编程,写了一本130万字的硬科幻小说”
- 【Typora】This beta version of Typora is expired, please download and install a newer version.
- 如何向服务器上传文件
- Without available task slots, what will happen to Flink's new tasks?
- [the problem has been solved] - Jenkins login exsi host without secret
- 【Typora】This beta version of Typora is expired, please download and install a newer version.
- 让你事半功倍的JS utils工具函数
- 云原生(八) | Devops篇之深入Devops
- Understand what configuration center is?
- C语言整数类型
猜你喜欢
随机推荐
mysql进阶(十三)命令行导出导入数据库
共享文件夹时,出现'试图共享XXXXX…
The three components of NiO Foundation
Multithreading and high concurrency day08
着力提升妇儿获得感、幸福感、安全感!未来十年广州妇女儿童事业这样发力
认清影响因子引发的是是非非,善待逆境中顽强崛起的国产期刊
Section 11 of Chapter 1: loop statement while
【Typora】This beta version of Typora is expired, please download and install a newer version.
Section 13 of Chapter 1: loop statement: for loop
[go open source treasure] performance tuning skills based on golang syntax (array traversal)
Section 12 of Chapter 1: use of break and continue
Google 为造芯再掀“抢人大战”,英特尔 17 年老将加入!
通信教程 | USB、HDMI、DP接口及速度
(Note)神经网络中的特征融合方式(add/concate)
如何向服务器上传文件
Chapter 1, section 6: Variables
视频分析StreamEye Studio
笔记。。。。
Notes....
[the problem has been solved] - MySQL uses the same yaml and NFS shared storage to report an error