03-07-2010 05:48 PM
I would like to display a wifi indicator in the titlebar similar to the browser app. Is there a function/setting to do this?
03-07-2010 06:06 PM - edited 03-07-2010 06:12 PM
You may have to "fake" this in your own application. You could use the following code to see if its on or not:
if(CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_CARRIER,RadioInfo.WAF_WLAN, false)){
coverageWiFi = true;
wifiLog.addlog("Coverage Status: Online");
}
If WIFI is turned on, you then show your icon, if it isn't then don't show it.
Get your logo here:
http://www.allfreelogo.com/logo/wifi-logo.html
03-07-2010 06:33 PM - edited 03-07-2010 06:39 PM
That won't work for updating the logo, but looking at the docs I see that you can add a listener. Thanks for the link to the logo. All free logos is a horrible site though, its as though their site designer was given the challenge to cover every inch in ads. I still need to figure out how to add an image to the right side of the field. Will read more docs.
03-08-2010 09:35 AM - edited 03-08-2010 09:36 AM
As far as I know, CoverageInfo.COVERAGE_CARRIER has alsmost nothing to do with pure Wi-Fi coverage. CoverageInfo.COVERAGE_CARRIER is set in the Wi-Fi case only after the OS tests the Wi-Fi network and establishes some secret property (probably that the gateway IP address and port(s) specified in the Wi-Fi TCP/IP Transport/Browser Service Book records are reachable). You can see that CoverageInfo.COVERAGE_CARRIER is never set if you connect to a private WLAN having no Internet access, however, your app will still be able to access hosts reachable from that WLAN.
The proper check is to query WLANInfo.getWLANState(). You could also query whether the WLAN interface is enabled or not (doesn't mean it's connected to an AP) using the RadioInfo class. Last but not least, you can subscribe to changes in WLANInfo.getWLANState() using WLANInfo.addListener().