I know there are a few questions similar to this,
ConnectionManager.getRestrictBackgroundStatus()
will give me whether background data is disabled for my app.
For my use case I want to know specifically if the Data Saver is enabled for all apps
settings->dataSaver->restrictBackgroundData
or specific app background data is disabled
app_Name->Info->Network->disable_backgroundData
ConnectionManager.getRestrictBackgroundStatus()
will give me the same answer in both the cases, how can I know which particular setting is enabled?
Checking if Data Saver is enabled and if your app is whitelisted is possible via ConnectivityManager.getRestrictBackgroundStatus()
If Data Saver is enabled and your app is not whitelisted, push notifications will only be delivered when your app is in the foreground.
You can also check ConnectivityManager.isActiveNetworkMetered() if you should limit data usage no matter if Data Saver is enabled or disabled or if your app is whitelisted.
Complete example in the docs where you can also learn how to request whitelist permission and listen to changes to Data Saver preferences.