Using these commands to force doze mode, it seems the whitelist works as we want.
I need to test the standby mode now.
B4X:
$ adb shell dumpsys battery unplug
$ adb shell dumpsys deviceidle step
You may need to run the second command more than once. Repeat it until the device state changes to idle.
What a big trouble with this Android 6 ....
Playing with adb I'm now at this conclusion:
With StartForeground and acquiring a PartialLock, your service will run (with no precise timing) also when the device enter the doze mode, but it's probably unuseful in most cases because in doze mode the internet connection is locked.
To grant the internet connection in doze mode your app must be in the whitelist. So the app, more or less, will continue to work as in Android 5, but anyway the service timing are not respected and we can forget to do something every 30 seconds or so.
The only solution to fully wake up the device from any low-consumption mode, is to use the high-priority GCM messages.
To study further for my best solution, I would need help from the forum to implement these three cases: