有没有办法检查网络共享是否处于活动状态?
我可以通过编程检查 Android 设备是否已激活网络共享吗?
我刚刚看了 WifiManager 课程。 WifiInfo 中的所有变量显示与设备上的 WIFI 关闭相同的值。
谢谢, 此致
can I check programmaticall wheter the android device has tethering activated?
I just watched the WifiManager class. All vatraibles from the WifiInfo show the same values as iff the WIFI is turned off on the device.
Thnaks,
best regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,您需要获取 WifiManager:
然后:
您还需要在 AndroidManifest.xml 中请求权限:
First, you need to get WifiManager:
Then:
Also you need to request a permission in AndroidManifest.xml:
尝试使用反射,如下所示:(
它返回一个
Boolean
)正如 Dennis 建议的那样,最好使用这个:(
管理器是
WiFiManager
)Try using reflection, like so:
(It returns a
Boolean
)As Dennis suggested it is better to use this :
(manager is the
WiFiManager
)