- Open phone's settings
- open battery
- open menu and select "battery optimization"
- from the dropdown menu select "all apps"
- select the app you want to whitelist
- select "don't optimize"
Now this app will show under not optimized apps.
An app can check whether it's whitelisted by calling