Good day. I wrote an android application that connects to the device via Wi-Fi and communicates with it. The device distributes Wi-Fi without an Internet connection. Everything worked well, checked on a working device with a version - 5.0. However, I decided to put the applications on my device with version 7.1.1 and then there was a problem.

When connected to this Wi-FI network, the application did not want to open a socket. It turned out that the system issues a message in notification that "the connected Wi-Fi network does not have access to the Internet." In order for the socket to open, the user must go into this alert and confirm that he wants to connect to this, "non-Internet" network.

Actually the question is: how to programmatically “skip” this notification and forcibly connect or at least display some dialogue with the proposal in the application?

    1 answer 1

    It began with Android 6.
    Try something like this:

    Settings.Global.putInt(getContentResolver(), "captive_portal_detection_enabled", 0); 
    • I did not even see information about this, where can I read? There is no such offense in off-line documentation in ordinary permits.) - ivanovd422
    • Thank you, read. It is interesting, is it possible to programmatically display a dialog about "confirming connection to a Wi-Fi network without the Internet" when the application is turned on? - ivanovd422
    • As I understand it, this is all for the sake of security, so that without the user's knowledge the applications do not connect to incomprehensible networks, it is not clear why. And the system here behaves like "his own master." - Eugene Krivenja
    • I would advise to look towards creating your own WIFI profile, or as it is called. The user will respond once, which allows him to create, perhaps later the system will be kinder :) - Eugene Krivenja