Is there any way to observe settings change for my app? I mean the settings that user can change in the "Settings", particular for my app, like battery optimizations, background restrictions etc. Here is what settings I mean in example of Gmail app:
Thanks in advance for your replies!
I found only one method, that indicate background restrictions:
isBackgroundRestricted()
for SDK > 28
https://developer.android.com/reference/android/app/ActivityManager#isBackgroundRestricted().
Example of usage:
if (VERSION.SDK_INT >= VERSION_CODES.P) {
val activityManager: ActivityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
Timber.w("Is app background restricted: ${activityManager.isBackgroundRestricted}")
}
Please leave a comment if you found more methods like this.