Let's say you've built an app that needs to download a large amount of data. As part of trying to ensure the best experience for the people using the app, you've added code that detects the type and speed of connection the device currently has.
So, what if the device is on a particularly slow connection? And/or they're on a mobile data connection (rather than a wireless/WiFi one) and so the financial cost of the transfer may matter? Or maybe they're using roaming data, and so the cost of transferring the data could be considerable?
As you may have guessed from the title of this post, the thing you shouldn't do is stop the person from attempting to make the download.
To do so says that you know better than them what they want.
Doing so says that your idea about what should be allowed is more important than what the person using the app is trying to achieve.
The data the app needs may be really important to what the person is trying to achieve. The desire to access the data and/or use the app that they've opened (presumably to perform a specific task) may be worth the cost of obtaining or delay in accessing the data.
Asking the person using the app to confirm their actions in this case not only makes sense, but is recommended.
Asking for confirmation at this time allows you to make sure that the person is aware of the consequences of what they're asking the app to do by downloading the data.
"You appear to be on a slow connection. Downloading may take some time. Are you sure you wish to continue?"
"You appear to be using roaming data. Downloading the data may cost more than usual. Are you sure you wish to continue?"
Asking each of the above questions (or similar) as appropriate, when combined with a "Remember my answer" capability, can lead to happier users.