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: 5
Registered: ‎02-08-2012
My Device: 9000
My Carrier: Singtel

ConnectionDescriptor always get null return.

I have an application which is using wifi or direct tcp network.

 

I found when blackberry device enter a no network area (eg. inside lift), it will happen radio turned off. When after back to normal network area, although radio is turned on, but my application cannot connect to network anymore.

 

But browser still able to serf webpage. Only my application cannot access internet.

I found that is because of ConnectionDescriptor always get null return. when this case happened.

I hope somebody can really help me, because I have tried to solve this for months, but still cannot get any solution.

Thanks.
below is part of my code.

int[] preferredTransportTypes = {TransportInfo.TRANSPORT_TCP_WIFI, TransportInfo.TRANSPORT_TCP_CELLULAR};
ConnectionFactory factory = new ConnectionFactory();
// Configure the factory
factory.setPreferredTransportTypes( preferredTransportTypes );
 
ConnectionDescriptor conDescriptor0 = factory.getConnection("ssl://talk.google.com:5223");
if ( conDescriptor0 != null)
{
	// connection suceeded
	int transportUsed = conDescriptor0.getTransportDescriptor().getTransportType();
	SecureConnection sc0 = null;
	try
	{
		sc0 = (SecureConnection) conDescriptor0.getConnection();
	}
	catch(Exception e)
	{
		System.out.println("fail to connect");
	}
	finally{
		sc0.close();
		sc0 = null;
	}
}
New Contributor
Posts: 2
Registered: ‎04-23-2010
My Device: 4.7
My Carrier: apps

Re: ConnectionDescriptor always get null return.

i guess when you wanted to create connection through wifi you have to append the deviceside=true parameter and the interface=wifi parameter to the end of the URL.

 

http://docs.blackberry.com/en/developers/deliverables/11938/Open_a_WiFi_socket_connection_509036_11....

 

 

Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: ConnectionDescriptor always get null return.

dhamu_tg is not correct, appending parameters manually was replaced by the factory.

applications may use other ways to connect, for example BIS, maybe TCP_CELLULAR is not working yet?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Contributor
Posts: 5
Registered: ‎02-08-2012
My Device: 9000
My Carrier: Singtel

Re: ConnectionDescriptor always get null return.

This application does not use BIS, this is one of the project requirement. Only can use direct tcp or wifi.

 

Now I meet this problem when using direct tcp. I run this test by using 2 different telco's SIM card

telco A does not meet this problem, only telco B got this problem.

 

Before I run my testing, I make sure my application able to connect to network successfully.

After that I put blackberry device with telco B's sim into a shield box, wait for 20~30min and take it out.

Make sure network is ready from no service, after that I tried to reconnect my application to network, and I found this problem happened. When it happened, even I tried to turn off gsm and only use wifi also cannot connect to network.

The only way to resolve this is to remove battery and restart device again, then connection will back to normal.

 

This problem really make me headache. Smiley Sad

Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: ConnectionDescriptor always get null return.

to debug i would suggest to use http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/system/CoverageInfo.html#isCov... with http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/system/CoverageInfo.html#COVER...
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter