ThanosFisherman / WifiUtils

Easily Connect to WiFi Networks
Apache License 2.0
734 stars 188 forks source link

Android 10 when network onUnavailable #68

Open xralphack opened 4 years ago

xralphack commented 4 years ago

I want to handle when user click the cancel button on the popup dialog. I did see the "AndroidQ+ could not connect to wifi" log when click the button. How can I add handler for this event?

networkCallback = new ConnectivityManager.NetworkCallback() {
            @Override
            public void onAvailable(@NonNull Network network) {
                super.onAvailable(network);

                wifiLog("AndroidQ+ connected to wifi ");

                // bind so all api calls are performed over this new network
                connectivityManager.bindProcessToNetwork(network);
            }

            @Override
            public void onUnavailable() {
                super.onUnavailable();

                wifiLog("AndroidQ+ could not connect to wifi");
            }
        };
eliaslecomte commented 4 years ago

I will tackle this problem but have to find the best way because success/error handling is decoupled from this code.

eliaslecomte commented 4 years ago

This is part of my pr: https://github.com/ThanosFisherman/WifiUtils/pull/82.