0
Good afternoon, I have the following method to check if the internet network is active at that time:
public static boolean isNetworkAvaliable(Context ctx) {
ConnectivityManager connectivityManager = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivityManager != null) {
NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo();
return (activeNetwork != null && activeNetwork.isConnected());
} else {
return false;
}
}
But NetworkInfo
as well as .getActiveNetworkInfo()
were discontinued in API 29. Anyone knows of any synchronous solution for API 29?
Thank you in advance.
Thank you very much Luis, I made some changes to my situation, but it worked very well.
– Murillo Comino