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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Contributor
lakmalvbj
Posts: 18
Registered: ‎10-31-2011
My Carrier: BAS
Accepted Solution

Connection fails without WIFI

Hi, 

 

I could successfully connect to the server and get data when there is WIFI. But when wifi is not available it fails. Using

 

ConnectionFactory factory = new ConnectionFactory();
factory.setPreferredTransportTypes(new int[]{
TransportInfo.TRANSPORT_TCP_WIFI,
TransportInfo.TRANSPORT_TCP_CELLULAR,
TransportInfo.TRANSPORT_WAP,
TransportInfo.TRANSPORT_WAP2,
TransportInfo.TRANSPORT_MDS,
TransportInfo.TRANSPORT_BIS_B
});

ConnectionDescriptor conDescriptor  = factory.getConnection("url");
int test5= conDescriptor.getTransportDescriptor().getTransportType();
int[] test =TransportInfo.getAvailableTransportTypes();
boolean test1 = TransportInfo.hasSufficientCoverage(6);
boolean test2 = TransportInfo.hasSufficientCoverage(1);
boolean test3 = TransportInfo.isTransportTypeAvailable(1);
String t = (TransportInfo.getTransportTypeName(1));

 

When I debug Test1 = false but test2 and test3 both returns true. Still the conDescriptor is null

 

 

Please help,

Janaka

 

Please use plain text.
BlackBerry Development Advisor
gbeukeboom
Posts: 1,837
Registered: ‎10-16-2009
My Carrier: Bell

Re: Connection fails without WIFI

Hi Janaka,

 

Did you set the APN for the TCP Cellular connection? 
ConnectionFactory#setTransportTypeOptions(int transPortType, TcpCellularOptions) 

 

If not already set on your device, this would be required to make the connection for most carriers.

 

Regards,

Garett Beukeboom
BlackBerry Development Advisor
Developer Zone
@garettbeukeboom

--
Think of a great new feature? Find a bug?
Log and track them using the Developer Issue Tracker
Please use plain text.
Contributor
lakmalvbj
Posts: 18
Registered: ‎10-31-2011
My Carrier: BAS

Re: Connection fails without WIFI

Hi Garett,

Thank you very much for your response. Yes it was APN issue. Working fine now.

Please use plain text.