On state detection of Android portable hotspot and acquisition method of SSID

How to obtain the enabled status and SSID of WiFi hotspot?

Open the WiFi manager.java source code to find the getwifiapstate() method. Surprisingly, you can get the hot spot state by calling this method directly. However, you can't call this method when calling... This method is hidden. At present, I call it through reflection.

So I wrote a radiation to get the status of the hot spot

The following states can be found through the annotation of the returned value of the getwifiapstate() method. After obtaining the current state value, you only need to compare the values of various states to know the open state of the hotspot

Similarly, the SSID of the hotspot is obtained through reflection

The above is the opening status detection and SSID acquisition method of Android portable hotspot introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>