开发者

Blackberry Java ConnectionFactory unavailable

I'm testing an application in a Pearl 9100. My app uses ConnectionFactory in order to get an available connection an perform an HTTP request.

I'm setting up the ConnectionFactory like this

protected int[] preferredTransportTypes = { TransportInfo.TRANSPORT_TCP_WIFI, TransportInfo.TRANSPORT_MDS, TransportInfo.TRANSPORT_TCP_CELLULAR };

protecte开发者_如何学Cd int[] disallowedTransportTypes = { TransportInfo.TRANSPORT_BIS_B, TransportInfo.TRANSPORT_WAP, TransportInfo.TRANSPORT_WAP2 };

Because I cannot use WAP or WAP2. Then I open the connection like this:

ConnectionDescriptor connd = cf.getConnection(url);

conn = (HttpConnection) connd.getConnection();

If I set WiFi ON and conneted to a WiFi Network, everything goes fine. But If I only leave the Mobile Network using 3G, the variable "connd" is Null when passing line number 1.

Why can this be possible?

Which should be the standard transport for a 3rd party app that wants to use the internet service?

Thanks!

Ezequiel


Why can this be possible?

Do you have your APN settings configured on device? They are wireless provider specific. Try googling on "BlackBerry APN settings " to find those settings.

Which should be the standard transport for a 3rd party app that wants to use the internet service?

Unfortunatelly, there is no simple answer. It depends, as they say. Check this tutorial for best practices and ideas. In the tutorial there is an approach on what transports and in what order to support.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜