Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
Gunjan
Posts: 47
Registered: 09-01-2009

how to check for internet connection(wifi,GPRS,EDGE) is enable or not programmatically?

hi

 

I want to check whether my device is connected to internert or not ? in order to do that i have use RadioInfo, WLANInfo, CoverageInfo classes... and use dialog box which tells user conncted or not.

it works as per the connection when i first load the simulator....

 

if i close all the connection from my manage connection it tells me not connected.....

if i enable only WLAN it i get it is connected but it is unable to make any connection to internet.

if i enable only EDGE it i get it is connected but it is unable to make any connection to internet.

if i reload the simulator and try to run same it works well. but once i change any connection to on or off i cant make any connection to internet.

 

please help me out its relly urgent please please

 

 

Please use plain text.
Developer
JCarty
Posts: 1,028
Registered: 01-25-2009

Re: how to check for internet connection(wifi,GPRS,EDGE) is enable or not programmatically?

What simulator version are you running and which OS are you targeting (i.e. 4.5, 4.7, 5.0, etc)?

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Please use plain text.
Developer
Gunjan
Posts: 47
Registered: 09-01-2009

Re: how to check for internet connection(wifi,GPRS,EDGE) is enable or not programmatically?

hey

m running JDE Os 4.7 and 9000 and 9500 simulator

can you please tell me now what should i do?

Thanks

Gunjan

 

 

Please use plain text.
Developer
chengbang69
Posts: 62
Registered: 01-22-2010
My Carrier: Globe

Re: how to check for internet connection(wifi,GPRS,EDGE) is enable or not programmatically?

what do you mean by "it is connected but is unable to make any connection to internet"?

Please use plain text.
Developer
girishthakr
Posts: 232
Registered: 12-15-2008
My Carrier: Vodafone India

Re: how to check for internet connection(wifi,GPRS,EDGE) is enable or not programmatically?

You can check it by :

 

 if((CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_MDS)) || (CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_BIS_B)) != false)

{

System.out.printls("Internet  available");

}

 

else

{

{

System.out.printls("Not  available");

}

 

 

Try it ..

 

Hope it works.

 

 

Thnx

Please use plain text.
New Contributor
wgroth2
Posts: 5
Registered: 12-05-2010
My Carrier: ATT

Re: how to check for internet connection(wifi,GPRS,EDGE) is enable or not programmatically?

This did not work for me. Is

 

RadioInfo.isDataServiceOperational();

 

 

suffficient?

 

Bill Roth

Please use plain text.
Developer
peter_strange
Posts: 14,614
Registered: 07-14-2008

Re: how to check for internet connection(wifi,GPRS,EDGE) is enable or not programmatically?

Please use plain text.
New Contributor
wgroth2
Posts: 5
Registered: 12-05-2010
My Carrier: ATT

Re: how to check for internet connection(wifi,GPRS,EDGE) is enable or not programmatically?

Love the sample code. Thanks!

Please use plain text.
New Contributor
mwaqasiqbal
Posts: 2
Registered: 11-16-2011
My Carrier: orange

Re: how to check for internet connection(wifi,GPRS,EDGE) is enable or not programmatically?

I used the function below to check if internet is not available, available through wifi or available through Mobile Network. For each I append the appropriate text so that if it finds wifi connectivity, It appends string to connect through wifi etc

 

import net.rim.device.api.system.CoverageInfo;

import net.rim.device.api.system.DeviceInfo;

import net.rim.device.api.system.WLANInfo;

 

private static String getConnectionString()

      {

            String value="";

            if(CoverageInfo.isOutOfCoverage())

                  {

                        Dialog.alert("No Internet Coverage. Enable Internet And Try Again");                       

//                      return "";

                  }                

           

           

            else if(WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED)

            {

                  Dialog.alert("Wireless Found");

                  value="interface=wifi";

//                return "";

            }

           

            else if(CoverageInfo.getCoverageStatus() ==  CoverageInfo.COVERAGE_DIRECT )

            {

                  Dialog.alert("Coverage Direct");

                  value="deviceside=true";

//                return "";

            }

            return value;

           

      }

Please use plain text.