CHECK WI-FI :

agosto 17, 2018 doido 2.0 0 Comments

public boolean verificaConexao() { boolean conectado = false; ConnectivityManager conectivtyManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (conectivtyManager.getActiveNetworkInfo() != null && conectivtyManager.getActiveNetworkInfo().isAvailable() && conectivtyManager.getActiveNetworkInfo().isConnected()) { conectado = true; } else { conectado = false; } return conectado; }

REQUIRED PERMISSIONS;

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE

0 Comments: