Force Android 6.x Marshmallow to use WiFi connection even without internet access
<p>I am working on a App and I need to talk to my router.
I need to download a file from the router with his <code>local ip</code>. If the router has no internet access, Android tries to download the file via <code>mobile network</code>.</p>

<p>Is there a way to force Android to use <code>WiFi</code> even when there is no internet access?
(its a new feature of Android <code>Marshmallow</code> to show WiFi but using mobile network).
The file is not accessible from <code>WAN</code> only from <code>LAN</code>.</p>

<p>I can force it, when I disable mobile network or turn on airplane mode with WiFi enabled, but this isn't an option. I need to force it programmatically for this specific download.</p>