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
Contributor
Posts: 18
Registered: ‎10-31-2011
My Device: 8900
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

 

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
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
@garettBeuk
--
Goodbye everybody!
Highlighted
Contributor
Posts: 18
Registered: ‎10-31-2011
My Device: 8900
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.