问题
I am attempting to programatically create a Wi-Fi access point on a Android tablet device (Nexus 10 - 4.2.2) and connect to it from a PC without success. Prior to posting a great slab of code and wasting peoples time, I'd like to check that I'm on the right track. The tablet has no 3G or 4G capability, and therefore does not normally require a access point (aka hot spot).
I am aware that the published Android API does not provide for this. The general technique I am using is described here http://www.whitebyte.info/android/android-wifi-hotspot-manager-class which uses reflection to access the WiFiManager methods
setWifiApConfigurationand
setWifiApEnabled. I am also aware that the method has changed since version 4.0 as explained here How to configue a static IP address, netmask, gateway programmatically on Android 3.x or 4.x
Using these methods, I am able to create an access point, and connect to it from a PC, but my attempts to set an IP address on the access point, and then to actually establish a connection (ie ping) from the PC to the tablet have not been successful. I have read many questions and answers here and elsewhere, but so far no luck.
Has anybody tried this or something similar?
How is using these undocumented methods generally regarded?
Has anyone documented the "undocumented" WifiManger methods?
Thanks Steve
来源:https://stackoverflow.com/questions/16050143/unable-to-programatically-create-working-wi-fi-access-point-on-jellybean-tablet