Determining WiFi state

Andras

Active Member
Licensed User
Longtime User
I need to know whether or not a wifi network is available to the device, and have tried to use the ABWifi library, which looks very handy.

With it, the app compiles properly but then runs into a fatal Java error on both the emulator and a target device as it lacks Android permission to access Wifi state.

Solutions or work-arounds? Ideas gratefully received!

Thanks!

John
 

Andras

Active Member
Licensed User
Longtime User
You can add the permission yourself.

Manifest Editor - Basic4android Wiki

Thanks - I hadn't realised that.

However, appending the code following still produces the same error; I presume it's a syntax glitch, but I don't know the exact form of the incantation and the documentation is sparse:

B4X:
AddPermission (android.permission.ACCESS_WIFI_STATE)

Presumably there's a little more to it than that?!

John
 
Upvote 0

GeorgeJ

New Member
Licensed User
Longtime User
I am still learning myself, but could it be ...
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
 
Upvote 0

Andras

Active Member
Licensed User
Longtime User
Thanks Erel!

Error message is as follows:

B4X:
Neither user 10053 nor current process has android.permission.ACCESS_WIFI_STATE

Thanks!

John
 
Upvote 0

Andras

Active Member
Licensed User
Longtime User
Just to add to the above, adding the following line to the Manifest has no effect on the error message, so I still have a problem here.

B4X:
AddPermission("android.permission.ACCESS_WIFI_STATE")

John
 
Upvote 0

Andras

Active Member
Licensed User
Longtime User
Ice Cream Sandwich? Nope - and I get the exact same error message from the emulator.

Odd one!

John
 
Upvote 0

alvinmb

Member
Licensed User
Longtime User
was this ever resolved?
I'm getting the same error when I try the ABwifi lib V 1.2 to get the MAC address of the device.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…