I was able to know whether the device is connected to wifi, Now i want to know whether the android device is turned on wifi hotspot, how to determine whether the android device is turned on wifi hotspot. is it possible?
Thanks.
Asked
Active
Viewed 565 times
0

eric
- 35
- 4
1 Answers
2
Try this way
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map_view);
prefs = new UserPrefs(this);
}
final WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
public static boolean isSharingWiFi(final WifiManager manager)
{
try
{
final Method method = manager.getClass().getDeclaredMethod("isWifiApEnabled");
method.setAccessible(true);
return (Boolean) method.invoke(manager);
}
catch (Exception e)
{
e.printStackTrace();
Toast.makeText(getApplicationContext(), ""+e, Toast.LENGTH_LONG).show();
}
return false;
}
AndroidManifest.xml
:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

Maveňツ
- 1
- 12
- 50
- 89
-
3I tried this method, it is very perfect。 @maveň ツ。Thanks maveň ツ – eric Nov 13 '14 at 11:36
-
happy to help always ツ – Maveňツ Nov 13 '14 at 11:46