是否有可能使用Android SDK和NDK禁用无线网络? [英] Is it possible to disable wireless networking using the Android SDK or NDK?

查看:245
本文介绍了是否有可能使用Android SDK和NDK禁用无线网络?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能禁止使用Android SDK和Android设备上的无线网络NDK?

Is it possible to disable wireless networking on an Android device using the Android SDK or NDK?

推荐答案

为了启用/禁用无线网络状态,你有权授予在应用程序下面的许可清单

In order to enable / disable the WiFi state, you have to grant the following permission in the application manifest

android.permission.CHANGE_WIFI_STATE

您可以再使用WifiManager设置启用/禁用WIFI。

You can then use the WifiManager to set enable/disable the WIFI.

WifiManager wifiManager = (WifiManager)getBaseContext().getSystemService(Context.WIFI_SERVICE);
wifiManager.setWifiEnabled(enabled);

http://developer.android.com/reference更多信息/android/net/wifi/WifiManager.html

有关完整示例,请检查下面的帖子: http://android-er.blogspot.com/2011/01/turn-wifi-onoff-using.html

For a complete sample, check the following post : http://android-er.blogspot.com/2011/01/turn-wifi-onoff-using.html

这篇关于是否有可能使用Android SDK和NDK禁用无线网络?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆