views:

99

answers:

1

Hi: Is it generally possible to have Wifi Tethering turned on (creating a Hotspot) and at the same time scanning for Wifi devices? I want several devices just discover (NOT connect) each other and log the signal strength. To do that all devices must be discoverable over Wifi and at the same time discover others. I would just need that for some specific use case..

+1  A: 

Hi, seems that you cannot do this by default way in android: if you have the wifi tethering enabled you cant use any wifi connectivity features (scan included). This is an exclusive functionality: tether or wifi client. The WifiManager seems to be in WIFI_UNKNOW state when you have the tethering enabled. I'm also investigating on this but I can't find any solution till now.

These are from the latest Froyo API (this method is marked as @hide) but i think you can access it throught reflection, I hope.

 public boolean setWifiApEnabled(WifiConfiguration  wifiConfig, boolean enabled)

Start AccessPoint mode with the specified configuration. If the radio is already running in AP mode, update the new configuration Note that starting in access point mode disables station mode operation

As you can see the AP mode will disable station mode operation (scanning etc)

I just tried it: you can use reflection and invoke the method to start the WifiAP. Then if you call the method startScan() on the WifiManager you will get a false response so the scan doesn't work with the WifiAP enabled.

Marco

markov00
Thanks for your evaluation! It would be interesting to hear from someone if this is due to hardware limitation or due to android system to do both at the same time!?
Sney