I'm developing an Android TV app with Jetpack Compose and Kotlin, which access to other installed apps like Netflix, I'd like to delete the cache from the installed apps which I logged in when I log out from my app. Is there any way to handle this?
Any solution to solve this
Please refer to the official documentation:
It is impossible to directly access the cache directory of another App programmatically in Android API >= 23.
What you could however do is let your App request Accessibility Provider permissions. Once the user grants your App that permission, the App can automatically open the Settings Page of the other App and simulate clicks on the buttons to clean the cache. This is what all modern Cache Cleaner Apps are doing.
See the explanation for how the SDMaid Cleaner App achieves it (GitHub):
So you will have to implement some logic that uses the Accessibility Service to perform clicks on the right buttons. You can follow this codelab to get started with Accessibility Services, especially have a look at the section "Acting on behalf of the user".