一. 修改"保持WLAN热点开启"的时间
Settings.System.putInt(getContentResolver(),Settings.System.WIFI_HOTSPOT_AUTO_DISABLE,Settings.System.WIFI_HOTSPOT_AUTO_DISABLE_FOR_FIVE_MINS);//空闲5分钟后关闭
//Settings.System.WIFI_HOTSPOT_AUTO_DISABLE_FOR_TEN_MIN 空闲10分钟后关闭
//Settings.System.WIFI_HOTSPOT_AUTO_DISABLE_OFF 始终(即:永不自动关闭WIFI热点)
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
二. 设置WIFI热点最大连接数
Settings.System.putInt(getContentResolver(),Settings.System.WIFI_HOTSPOT_MAX_CLIENT_NUM, num);//num为限制的连接数
<uses-permission android:name="android.permission.WRITE_SETTINGS" />