Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4android > Additional libraries, classes and official updates
Documentation Wiki Register Members List Windows Mobile Search Today's Posts Mark Forums Read

Additional libraries, classes and official updates Users contributed libraries, classes and official updates. This forum is open for licensed users only.

Wifi Library

Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 04-14-2011, 04:14 PM
Junior Member
 
Join Date: Mar 2011
Location: Wroclaw
Posts: 26
Smile Great library but I see some strange results



Hi Alwaysbusy, thanks for this great library. I am new to this forum and I have started only recently to work with B4A but I wanted to try your library right away. ANYWAY, GREETINGS TO EVERYBODY HERE IN THE FORUM!

Right now I am most interested to get the location info thanks to your library into the "FindMe" app posted here on the user app forum as well. So, I have put your sample code in a small test app first and I was quite surprised that the VERY SAME TEST APP produces different results on different Android devices: on an Archos 70 it produces the right values for long/lat and there is no error message whatsoever. But on an Archos 101 the myWifi.ABGetLocation produces always "FALSE" and there is no error message (empty string). Other Wifi information works though. I checked the settings option "Use Wireless networks for location determination..." but it is checked. (Btw: if uncheck you get "No Provider Found" as error message. Could you programmatically verify and check/enable this option with an library update?).

Q1: Do you have any idea what is going on here? Why do I see different behaviour and why do I have an empty error string on the non-working device. Both Archos devices are practically identical apart from the different screen size, they are both running on the same wireless network and are connected to Internet. There is no GPS onboard which might interfere.

Q2: If I switch on the "good" device (A70) the 'Airplane mode' on I would expect that I cannot retrieve anymore information on network and location. Instead I still get the information - even after having killed/restarted my test app. Only after a reboot of Android I get correct info 'no network'.

Q3: Does this LIB uses anything (a service, website etc.) from GOOGLE or does it only work on Google authorized SmartPhones??? I ask because on the Archos 70 tablet (not a phone), I have the Android Market installed and running. The Google Map application works there too but on the bigger Archos 101 I have nothing from Google...

Greetings!

alex
Attached Files
File Type: zip Wifi&SoftGPS_TestApp.zip (5.2 KB, 123 views)

Last edited by alexb : 04-14-2011 at 06:38 PM. Reason: Added Test App
Reply With Quote
  #12 (permalink)  
Old 04-15-2011, 02:45 PM
XverhelstX's Avatar
Basic4android Expert
 
Join Date: Mar 2011
Location: Belgium
Posts: 886
Default

I always have a No Provider Found message?
How does this come?

XverhelstX
__________________
B4A Docs|B4A Wiki|B4A Unofficial Chat
I'm a freelance library developer! Check out this topic!

Reply With Quote
  #13 (permalink)  
Old 04-19-2011, 02:03 PM
alwaysbusy's Avatar
Junior Member
 
Join Date: Oct 2007
Location: Belgium
Posts: 94
Thumbs up

Sorry for the delay in my answer.

The lib needs GPS or NETWORK (Network is Wifi or GSM). If none is available you'll get 'No provider Found'.

I'll check them by doing this:

Code:
    lm = (LocationManager) ba.context.getSystemService("location");
    //exceptions will be thrown 
if provider is not permitted.
    
try{
       gps_enabled=lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
        }
catch(Exception ex){
            //System.out.println(
"error gps!");
        }
    
try{
    network_enabled=lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
        }
catch(Exception ex){
            //System.out.println(
"error netwerk!");
        }

    //don
't start listeners if no provider is enabled
    if(!gps_enabled && !network_enabled)
    {
        lastError=
"No Provider Found"
        
return false;
    }
to get the location, i'll use:

Code:
if(gps_enabled)
            gps_loc=lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if(network_enabled)
            net_loc=lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
According to some info I found on the net, android does keep track of your last location and if no way is found to update your location, it returns this last location.
This last location is reset by a reboot.

I do think google is used in some way by calling this getLastKnownLocation() function so this may explain why Archos has problem with it.

Remember you have to see this as a last way to get your location. First always try the GPS lib to get an accurate location. I've got reasonable succes using it, but sometimes it is way off (like 500m).
I'm guessing this is the way Google maps finds your location if no gps is found. I'm getting similar results anyway.

Last edited by alwaysbusy : 04-19-2011 at 02:44 PM.
Reply With Quote
  #14 (permalink)  
Old 04-19-2011, 04:05 PM
Knows the basics
 
Join Date: Feb 2011
Posts: 255
Default

Just wanted to say thank you for the library

I mentioned a problem I was having with it, because it is an activity object, in a different thread and it was pointed out that the problem was because

Quote:
the AbWiFi object in the WiFi library is declared as an Activity object. This is not necessary as it does not interact with UI elements but this prevents its use in a Service. It needs recompilation by the author as a non-Activity object.
I have found a way around it for the one feature I needed to access from the library but thought I would mention it here as I am sure being able to use the library in a service would make it even more useful to more people.

Dave
Reply With Quote
  #15 (permalink)  
Old 04-20-2011, 07:25 AM
alwaysbusy's Avatar
Junior Member
 
Join Date: Oct 2007
Location: Belgium
Posts: 94
Default



Woops, I had taken the framework of another library i've written and forgot to remove the Activity part. Thanks to mistermentality for pointing that out

The library is now updated to 1.1 in the first post.
Reply With Quote
  #16 (permalink)  
Old 04-20-2011, 11:32 AM
Knows the basics
 
Join Date: Feb 2011
Posts: 255
Default

Quote:
Originally Posted by alwaysbusy View Post


Woops, I had taken the framework of another library i've written and forgot to remove the Activity part. Thanks to mistermentality for pointing that out

The library is now updated to 1.1 in the first post.
Thank you, I can confirm that it works in a service now as well as an activity

Dave
Reply With Quote
  #17 (permalink)  
Old 05-17-2011, 10:28 AM
Junior Member
 
Join Date: Mar 2011
Location: West Wales
Posts: 74
Default

Is there anyway to convert the MacAdress string which is returned by the library to a decimal number please?
Reply With Quote
  #18 (permalink)  
Old 06-06-2011, 01:18 AM
Basic4android Expert
 
Join Date: May 2011
Posts: 749
Default

If wifi is enabled but not connected, I get a null pointer on initialize

Last edited by NeoTechni : 06-06-2011 at 02:50 AM.
Reply With Quote
  #19 (permalink)  
Old 06-06-2011, 02:51 AM
Basic4android Expert
 
Join Date: May 2011
Posts: 749
Default

Quote:
Originally Posted by CharlesR View Post
Is there anyway to convert the MacAdress string which is returned by the library to a decimal number please?
Can you give an example?
Reply With Quote
  #20 (permalink)  
Old 06-15-2011, 04:49 AM
Brad's Avatar
Knows the basics
 
Join Date: Dec 2010
Location: Seattle
Posts: 197
Default

What accuracy do you get? with my moto droid it's been off about 1 mile.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wish: WiFi Library TOB Bugs & wishlist 8 02-25-2011 11:44 AM
Filecopy wifi question fatman Questions (Windows Mobile) 3 10-29-2010 11:56 AM
Enable / disable WiFi lancaster Questions (Windows Mobile) 3 08-01-2009 05:38 AM
Wifi on desktop ? taximania Questions (Windows Mobile) 5 03-27-2008 05:53 PM
WiFi Signal alfcen Basic4ppc Wishlist 2 12-27-2007 11:52 PM


All times are GMT. The time now is 11:46 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0