黑莓无线http连接 [英] Blackberry wifi http connection

查看:124
本文介绍了黑莓无线http连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立一个黑莓应用程序需要来自用户的输入然后发送输入到服务器并显示XML从服务器返回。

问题是,当应用软件可在模拟器罚款不显示结果都在实际设备的时间。有时,它是工作,但通常它不是。我使用的设备无线连接。在code是:

  Connector.open(URL +接口=无线);

我不使用模拟器上的wifi。我只是删除'界面=无线网络的一部分,它运行使用MDS。

当输入取,一类扩展Thread启动。它打开了连接和初始化变量。我从类中的InputStream和解析XML。该器件是一款黑莓9700.I读一些有关连接超时,但我不知道在哪里的问题是。

编辑:找到一个简单的方法来连接。这里是code的GET请求:

 连接工厂CF =新的ConnectionFactory();
ConnectionDescriptor CD = cf.getConnection(yourURL的);
httpConnector =(HttpConnection的)cd.getConnection();
httpConnector.setRequestMethod(HttpConnection.GET);


解决方案

这也许可以帮助:<一href=\"http://www.localytics.com/blog/2009/how-to-reliably-establish-a-network-connection-on-any-blackberry-device/\" rel=\"nofollow\">http://www.localytics.com/blog/2009/how-to-reliably-establish-a-network-connection-on-any-blackberry-device/

在博客中这样做是为了检查是否无线已启用,并且在这种情况下使用该连接字符串,等等各种连接类型。

I am building a blackberry application takes input from user then send input to a server and displays the xml returned from server.

The problem is, while application works fine on simulator it doesn't show results all the time on real device. Sometimes it is working but usually it's not. I am using wifi connection on device. The code is:

Connector.open(url + ";interface=wifi");

I am not using wifi on simulator. I just delete the 'interface=wifi' part and it runs using mds.

When input taken, a class extending Thread starts. It opens the connection and initializes variables. I take the inputstream from class and parse the xml. The device is a Blackberry 9700.I read something about connection timeout but i am not sure where problem is.

Edit: Found a simple way to connect. Here is the code for a GET request:

ConnectionFactory cf = new ConnectionFactory();
ConnectionDescriptor cd = cf.getConnection("YourUrl");
httpConnector = (HttpConnection) cd.getConnection();
httpConnector.setRequestMethod(HttpConnection.GET);

解决方案

Maybe this might help: http://www.localytics.com/blog/2009/how-to-reliably-establish-a-network-connection-on-any-blackberry-device/

The idea in that blog post is to check if WiFi is enabled, and in that case use that for connection string, and so on for various connection types.

这篇关于黑莓无线http连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆