We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In my app, user can log out so i must clear all saved info.
I have class AppCleaner that listens to user events and do clean
object AppCleaner: KoinComponent { private lateinit var applicationContext: Context private val roomDatabase by inject<Database>() private val userLifecycle by inject<Lifecycle>(userLifecycleQualifier) fun init(context: Context) { applicationContext = context.applicationContext GlobalScope.launch { userLifecycle.stopped() .collect { clearCache() clearRoom() clearSharedPrefs() } } } private fun clearRoom() { roomDatabase.clearAllTables() } private fun clearSharedPrefs() { applicationContext.filesDir.parentFile?.let { root -> File(root, "shared_prefs") .list() ?.let { for (fileName in it) { applicationContext.getSharedPreferences( fileName.replace(".xml", ""), Service.MODE_PRIVATE ).edit { clear() } } } } } private fun clearBinaryPrefs() { TODO() } private fun clearCache() { applicationContext.cacheDir.deleteRecursively() } }
Can you help me with solution that will clean all binary prefs?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In my app, user can log out so i must clear all saved info.
I have class AppCleaner that listens to user events and do clean
Can you help me with solution that will clean all binary prefs?
The text was updated successfully, but these errors were encountered: