plus_plugins icon indicating copy to clipboard operation
plus_plugins copied to clipboard

[Question]: network_info_plus can not get the WifiGatewayIP.

Open ykwang opened this issue 1 year ago • 2 comments

What is your question?

I can get getWifiName by network_info_plus . But Can not get the GatewayIP.

Checklist before submitting a question

  • [X] I searched issues in this repository and couldn't find such bug/problem
  • [X] I Google'd a solution and I couldn't find it
  • [X] I searched on StackOverflow for a solution and I couldn't find it
  • [X] I read the README.md file of the plugin
  • [X] I am using the latest version of the plugin
  • [X] All dependencies are up to date with flutter pub upgrade
  • [X] I did a flutter clean
  • [X] I tried running the example project

ykwang avatar Sep 24 '24 10:09 ykwang

You need to provide more details in your question, like which platform are you using, which plugin version, if you ran the example project, etc.

miquelbeltran avatar Sep 24 '24 11:09 miquelbeltran

插件 getGatewayIPAddress 方法 val linkAddresses = connectivityManager?.getLinkProperties(connectivityManager.activeNetwork) 获取的是可用的网络,并不是连接的wifi网络,比如说你同时连接wifi网络,和5G网络,并且正巧你的wifi网络不可用获取的就是5G网络的网关地址,所有需要修改插件源码: val networks = connectivityManager.allNetworks for (network in networks) { val networkCapabilities = connectivityManager.getNetworkCapabilities(network) if (networkCapabilities != null && networkCapabilities.hasTransport( NetworkCapabilities.TRANSPORT_WIFI)) { // 获取 Wi-Fi 的 LinkProperties val linkProperties = connectivityManager.getLinkProperties(network) Log.d("TAG", "Wi-Fi LinkProperties: $linkProperties") Log.d("TAG", "Wi-Fi LinkProperties dhcpServerAddress : ${linkProperties!!.dhcpServerAddress!!.hostAddress}") } },希望作者能重新加一个新的方法,获取修改下方法,再次上传到pub网站上使用,谢谢

zhangyibo007 avatar Sep 25 '24 04:09 zhangyibo007

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days

github-actions[bot] avatar Dec 25 '24 00:12 github-actions[bot]