Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Posts: 133
Registered: ‎12-31-2009
My Device: Not Specified

How to check whether GPRS / WiFi is avialable

Hello Friends,

 

I want to check programatically that whether GPRS / WIFi is avialable on my handset or not?

 

How can I achieve this?

 

 

 

Thank you

 

 

 

 

 

Developer
Posts: 159
Registered: ‎08-19-2008
My Device: Not Specified

Re: How to check whether GPRS / WiFi is avialable

Use CoverageInfo class to determine whether your device is in coverage or not ...........For Wifi you can use this code

 

if ( ( RadioInfo.getActiveWAFs() & RadioInfo.WAF_WLAN ) != 0 )
        {
           
            if(CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_DIRECT, RadioInfo.WAF_WLAN, true))
               {
                     System.out.println("Wi-fi connected");
                st = ";deviceside=true;interface=wifi";
            }

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to check whether GPRS / WiFi is avialable

Can I suggest that the first thing before asking a quesiton, is search the forum?  This sort of question gets asked frequently. 

New Developer
Posts: 133
Registered: ‎12-31-2009
My Device: Not Specified

Re: How to check whether GPRS / WiFi is avialable

Hello perter_strange,

 

Thank you for your reply.

I had searched but I was not able get the proper information. It may the case that I have not searched enough but I searched for 30 minutes before posting the thread. I f this is already been discussed then I apologize for my mistake.

 

 

Thank you

 

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to check whether GPRS / WiFi is available

Two minutes, searched for "WiFi status", clicked on one that looked interesting, found this:

 

http://supportforums.blackberry.com/t5/Java-Development/How-to-check-active-network-connection-n-Bla...

 

which is pretty much what you have been told above, I admit not as clearly.

 

Searching means we don't get the same question asked twice on the forum, fewer posts means less junk to wade through.  Saves us (the people that answer) time because we respond to new questions, these get better answers. 

 

If you do search, and don't find anything, then tell us that and what you searched for.  If we know there is a Thread that would have answered your question, then we can make sure it has the right tags, so the next person will find it. 

 

But most importantly, searching is good for you because typically you find your own answer faster.