B4A Library Wifi Library

francoisg

Active Member
Licensed User
Longtime User
IsConnected property

Hi,
the lib seems to work fine - the only issue I have is the IsConnected property. It does not seem to work - always reports false (using SE Experia X10).

The only solution thus far is to look at the State property (UNINITIALIZED / COMPLETED) strings to figure out if the device is connected to wifi or not.

Maybe I am using the lib wrong???

Anyway, thanx for a great lib!!!!

Regards,
M. le Roux
 

bluedude

Well-Known Member
Licensed User
Longtime User
I think the location stuff isn't working properly. I have WIFI on on a Nexus one but GSM off. It should give me a location but it tells me "no provider found".

I guess it needs both WIFI and GSM?

Cheers,
 

rbsoft

Active Member
Licensed User
Longtime User
Thank you, Alain, for this excellent library.

Tried the location stuff on my Galaxy Tab und HTC Desire. With Wifi I get a very good position with an accuracy of 80 meters, without GSM accuracy is 800 m.

Which brings me to my question about the basics!
Where does a Wifi connection get accurate coordinates from? Could somebody enlighten me?
 

corwin42

Expert
Licensed User
Longtime User
Which brings me to my question about the basics!
Where does a Wifi connection get accurate coordinates from? Could somebody enlighten me?

Google collects informations about SSIDs and its GPS positions in many ways. One is Google StreetView cars. They also collected SSIDs and their positions. I think another way is Google Maps which can report SSIDs and exact GPS positions to Google.
 

rbsoft

Active Member
Licensed User
Longtime User
I did some testing yesterday while driving from Bochum to Essen on the A40 (Germany). Got very interesting results.

Scenario: GPS switched off, Wifi and 3G on.

Whenever I was to far from any houses (and likewise Wifi routers) on the highway I got no accurate positions. But as soon as I got close to houses, especially denser populated areas, it became very accurate. In most cases I was shown the exact adress, sometimes just the next house or so.

I wonder what else can be done with all of that accumulated data!
 

Inman

Well-Known Member
Licensed User
Longtime User

I have the same issue as well. Thankfully the State property works.
 

Gary Miyakawa

Active Member
Licensed User
Longtime User
I've run into an inconsistance problem with the number of Networks this library returns. Has anyone else seen this ? (I created a new thread for it too)..

Thanks,

Gary M
 

andrewtheart

Member
Licensed User
Longtime User
What conditions would cause ABGetLocation("myWifi") to return false and ABWifiLastError() to be blank when -

a) device is connected to a wireless network, and
b) "Use wireless networks" is enable in the Android location settings?

I am stumped.
 

andrewtheart

Member
Licensed User
Longtime User
What conditions would cause ABGetLocation("myWifi") to return false and ABWifiLastError() to be blank when -

a) device is connected to a wireless network, and
b) "Use wireless networks" is enable in the Android location settings?

I am stumped.
Right now the only possibility I can think of is that the wireless network is secured with WEP or WPA2 PSK (don't know which as a user connected to their home network is reporting these issues to me)

I don't have this issue on 3g networks and on a wireless network with "open authentication" (access control through MAC address filtering)
 

pinoy_ako

Member
Licensed User
Longtime User
is there a way to programmatically connect a wifi device to android phone? i have a mini wifi camera, android phone can't find the camera. but windows phone and iphone can find.

i also have this problem before with LMX9838 uart bluetooth. it can't be detected by android phone. but you can connect to it by setting the bt id on your program.

i dont know how to do it in wifi. need advice. appreciate your help.

thanks
 

Inman

Well-Known Member
Licensed User
Longtime User
Thanks for the update. Anyway to fix the issue mentioned by francoisg?

 

alwaysbusy

Expert
Licensed User
Longtime User
I cannot reproduce the problem here.

There is not much happening. When you run ABLoadWifi it checks your current Wifi connection. If your are connected, I'll temporary save it's SSID.

Then I'll run over all the wifi connections and if the SSID = temporary saved SSID I'll set isconnected to true.

Maybe you can check it in b4a by doing the same.

Do an ABLoadWifi, do a for loop through all the found wifi's (with ABNumberOfAvailableWifiNetworks and ABGetWifiNetwork) and check if the SSID of one of them = ABGetCurrentWifiInfo.SSID

It's the same check I'll do in Java.
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
Having some trouble, myWifi.ABNumberOfAvailableWifiNetworks returns 0 even though OS Settings returns a bunch of wifi hotspots near me
 

Gary Miyakawa

Active Member
Licensed User
Longtime User
I found that I had to wait at least 2.5 seconds before the wifi names/count would be available (and correct)...

Cheers,

Gary M
 

NJDude

Expert
Licensed User
Longtime User
I found that I had to wait at least 2.5 seconds before the wifi names/count would be available (and correct)...

Cheers,

Gary M

Just an observation, the "wait" time varies from device to device, a pause is needed indeed, but you better put a longer pause or slower devices will fail to acquire the available WiFi networks in range.
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
That sounds sub-optimal...

Could you either:
-trigger an event when its done
-have a variable set to false when we poll for hotspots then switch to true when done?

EDIT: Right now I'm polling till ABNumberOfAvailableWifiNetworks>0 but then I can't tell the difference between it's still loading or no hotspots were found

EDIT2: So what exactly is the signal level? It's always a negative number, and seems to be inversely proportional to the actual signal strength
Ah, it's in dBm. And I have to convert it to % myself...

http://www.tamos.com/htmlhelp/commwifi/understandingsignalstrength.htm

The level of 100% is equivalent to the signal level of -35 dBm and higher, e.g. both -25 dBm and -15 dBm will be shown as 100%, because this level of signal is very high. The level of 1% is equivalent to the signal level of -95 dBm. Between -95 dBm and -35 dBm, the percentage scale is linear, i.e. 50% is equivalent to -65 dBm.

http://www.tested.com/news/how-to-measure-cell-signal-strength-on-android-phones/557/

A signal of -60dBm is nearly perfect, and -112dBm is call-dropping bad. If you're above about -87 dBm, Android will report a full 4 bars of signal.
 
Last edited:

droman

Member
Licensed User
Longtime User
There are some functions in this library that tells us the name of the city in which the user is?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…