Whitelisting won't disable the doze mode for your app, but you can do that by using network and hold-wake locks.
Whitelisting an Android application programmatically can be done as follows:
boolean isIgnoringBatteryOptimizations = pm.isIgnoringBatteryOptimizations(getPackageName());
if(!isIgnorin...