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 Contributor
Posts: 8
Registered: ‎03-29-2011
My Device: 9800
My Carrier: Singtel

Check if APN is Initialized

Hi,

 

I have an app that runs on startup and immediately connects to the internet.  This works perfectly fine in Torch but not on Curve because I think curve loads up the APN slower and Thread.sleep() doesn't help me so much as the loading time varies and too much Thread.sleep() is unacceptable.

 

Thus my question is, is there a way for the app to check if the APN is already initialized?

 

Thanks!

Highlighted
Developer
Posts: 220
Registered: ‎09-09-2008
My Device: Bold 9780
My Carrier: Telstra AU

Re: Check if APN is Initialized

hi there,

 

you could check if the device has network connection ?

-----------

Follow me on twitter: twitter.com/paul.haenel

If your issue is resolved, please mark this thread as solved.

Set the "Solution" mark on the post which contains the answer to your question.
New Contributor
Posts: 8
Registered: ‎03-29-2011
My Device: 9800
My Carrier: Singtel

Re: Check if APN is Initialized

Hi!

 

Thanks for the reply.  I already did that via CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_DIRECT) ) but this wasn't helpful.  It returns true but when I try to connect, it sometimes throws one of these errors:

 

APN is not specified 

or

Critical Tunnel Error

 

However, after about 30 seconds or so, using the same lines of code, I am able to connect.

Developer
Posts: 220
Registered: ‎09-09-2008
My Device: Bold 9780
My Carrier: Telstra AU

Re: Check if APN is Initialized

have you seen this thread ?

-----------

Follow me on twitter: twitter.com/paul.haenel

If your issue is resolved, please mark this thread as solved.

Set the "Solution" mark on the post which contains the answer to your question.
Trusted Contributor
Posts: 151
Registered: ‎06-17-2010
My Device: Curve 8900
My Carrier: Vodafone

Re: Check if APN is Initialized

Hi julykillua22,

 

Here is the method i use to check coverage... try this one..

 

 

public static boolean checkCoverage() {
		boolean _outOfCoverage = false;
		if (!CoverageInfo.isOutOfCoverage()) {
			// check to see if the available coverage is of sufficient strength
			_outOfCoverage = !(
					CoverageInfo.isCoverageSufficient(RadioInfo.WAF_WLAN) ||
					CoverageInfo.isCoverageSufficient(RadioInfo.WAF_3GPP) ||
					CoverageInfo.isCoverageSufficient(RadioInfo.WAF_CDMA) ||
					CoverageInfo.isCoverageSufficient(RadioInfo.WAF_IDEN)
			);
			if (_outOfCoverage) {
				//In network coverage, but insufficient strength
				return false;
			}
			else {
				//In network coverage
				return true;
			}
		}
		else {
			// definitely out of network coverage
			_outOfCoverage = false;
		}
		return _outOfCoverage;
	}

 


 

 

Feel free to press the kudos button  on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.