读取Wifi / 3G状态的exception

嗨,我有以下代码,读取网络/ Wifi状态:

public String getMacAddress() { WifiManager wm = (WifiManager) context .getSystemService(Context.WIFI_SERVICE); return wm.getConnectionInfo().getMacAddress(); } 

这引发了

 Caused by: java.lang.SecurityException: WifiService: Neither user 10032 nor current process has android.permission.ACCESS_WIFI_STATE 

 public boolean is3G() { ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); return !(connectivityManager.getNetworkInfo( ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED || connectivityManager .getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED); } 

这引发了

 Caused by: java.lang.SecurityException: ConnectivityService: Neither user 10032 nor current process has android.permission.ACCESS_NETWORK_STATE. 

在有人告诉我权限之前,那就是我的Manifest(相关部分):

          

    你错误地使用了最新的2个权限:

    useR-permission而不是useS-permission

    您的清单权限是错误的。

    您拥有用户权限而不是使用权限