如何在 Android 中实例化 FileIntegrityManager?
语言:Kotlin Android Studio HedgeHog | Android Studio 2023年1月1日(2023年11月) 目标SDK 33
val foo = FileIntegrityManager()// Compile Error: Error message says init is private so you cannot access it.
我检查了 FileIntegrityManager 声明的文件中的另一个初始值设定项,但看起来开发人员无法访问它。你如何初始化这个类?
我应该实例化 FileIntegrityManager。
您不自己创建实例。相反,在
getSystemService(FileIntegrityManager::class.java)
上调用 Context
来获取 FileIntegrityManager
实例。
FILE_INTEGRITY_SERVICE
传递给 getSystemService()
。