黑莓真实设备上的HTTP连接错误 [英] Http connection error on the blackberry real device
问题描述
我想建立用于测试目的,我想提出一个简单的HTTP连接.The code是在模拟器上运行完美,但是当我真正的设备上测试应用它没有返回一个简单的应用程序任何反应code。我认为这是在HTTP连接一些错误。
I am trying to build a simple application for testing purpose in which I am making a simple Http connection .The code is running perfectly on the simulator but when I am testing the app on the real device it is not returning any response code. I think there is some error in http connection .
下面是code,我使用HTTP连接:
Here is the code that I am using for http connection:
httpConnection = (HttpConnection)Connector.open("http://www.google.com");
这是我使用的设备是黑莓8520 v5.0.0.592
The device that I am using is Blackberry 8520 v5.0.0.592
也给我怎样从实际设备中使用Eclipse插件做任何应用程序的debuging一些提示。
Also give me some tips on how to do the debuging of any app from real device using eclipse plugin.
在此先感谢。
推荐答案
如果这是不够你的程序适用于OS 5.0及以上版本,然后尝试使用的网络API :
If it is enough that your program works with OS 5.0+, then try using Network API:
ConnectionFactory f = new ConnectionFactory();
ConnectionDescriptor descr = f.getConnection("http://www.google.com");
HttpConnection connection = (HttpConnection) descr.getConnection();
这件code的尝试使用第一个可用的连接类型。如果你愿意,你可以微调它。
That piece of code tries to use the first available connection type. You can fine tune it if you want.
关于调试,只需安装黑莓桌面软件,使用USB电缆,并从日食连接您的8520,单击运行 - >调试为... - >黑莓设备
Regarding debugging, just install BlackBerry Desktop Software, connect your 8520 with the USB cable and from eclipse, click Run -> Debug As... -> BlackBerry Device.
这篇关于黑莓真实设备上的HTTP连接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!