I am creating wifi hotspot in my phone and I want get its state change event when I switched on or off hotspot.
try this
Write this code into OnCreate() method
ConnectivityManager cm = (ConnectivityManager) getSystemService(con.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnectedOrConnecting()) {
Success
}
else {
Give Some Error Message
}
also mention necessary permission to manifest file