和我之前的许多人一样,我在使用 BlackBerry 平台(在我的例子中为 4.6.1)时遇到了 HttpConnection 问题。
我需要执行对 Web 服务的调用,并且模拟器(使用 MDS 和 WiFi)一切正常,但当使用真正的电话(8250)时,只有 WiFi 可以工作。
我的测试手机与意大利的许多手机一样,有 BIS 数据计划,没有默认的 APN 配置。正如我所说,这对于我的国家/地区电话来说是非常常见的配置,因此我想在不强迫用户指定任何连接参数的情况下解决问题。
我已经尝试使用 Connector.Create 方法的所有变体创建 HttpConnection:
- (HttpConnection)Connector.open(uri); // 未指定参数
- (HttpConnection)Connector.open(uri + ";deviceside=true");
- (HttpConnection)Connector.open(uri + ";deviceside=false");
- (HttpConnection)Connector.open(uri + ";interface=wifi");
- (HttpConnection)Connector.open(uri + ";deviceside=false;ConnectionUID=uid");
4,即 WiFi,是唯一适合我的方法。
编号 1 和 3 未能抱怨缺少 APN 配置。
编号 2 失败,因为我未连接到 BES 基础设施。
数字 5 失败,因为使用 BB 文档总是返回空值(可能是因为未配置WAP2?)
我没有测试WAP1解决方案,因为普通用户可能不知道配置它所需的参数。
我刚刚发现 "mds-public" 魔法字符串也可能会影响连接,但我仍然需要调查它的含义以及对我的运营商的影响。
所以,最后,真正的问题是:您认为对我来说唯一的解决方案是请求访问 BIS-B 服务并成为联盟合作伙伴计划成员吗?你知道,如果没有必要的话,我想在要求老板支付费用之前先确定一下。
非常感谢,
亚历山德罗
I'm here, as many before me, with an HttpConnection problem using the BlackBerry platform (the 4.6.1 in my case).
I need to perform a call to a web service and everything works fine from the emulator (using MDS and WiFi) but when using a real phone (an 8250) only the WiFi works.
My test phone, like many here in Italy, has a BIS data plan and no default APN configuration. As I told, this is a very common configuration for my country phones so I'd like to solve the problem without forcing the user to specify any connection parameter.
I already tried to create an HttpConnection using all the variants of the Connector.Create method:
- (HttpConnection)Connector.open(uri); // No parameters specified
- (HttpConnection)Connector.open(uri + ";deviceside=true");
- (HttpConnection)Connector.open(uri + ";deviceside=false");
- (HttpConnection)Connector.open(uri + ";interface=wifi");
- (HttpConnection)Connector.open(uri + ";deviceside=false;ConnectionUID=uid");
Number 4, i.e. WiFi, is the only method working for me.
Number 1 and 3 fail complaing about the missing APN configuration.
Number 2 fails because I'm not connected to a BES infrastructure.
Number 5 fails because the uid retrieved with the code shown into the BB documentation always return a null value (maybe because WAP2 is not configured?)
I didn't test the WAP1 solution because the average user will probably not know the parameters needed for configuring it.
I've just discovered that also the "mds-public" magic string may affect the connection but I still have to investigate on its meaning and the effects on my carrier.
So, finally, the real question: Do you think that the only solution for me is to request the access to the BIS-B service and so to become an Alliance Partner program member? You know, I'd like to be sure before asking to my boss to pay for it if it is not necessary.
Thanks so much in advance,
Alessandro
发布评论
评论(3)
我建议您使用这个
http:// /www.versatilemonkey.com/blog/index.php/2009/06/24/networking-helper-class/
我们在项目中使用它,并进行了一些修改。
它测试所有可用的传输并选择第一个有效的传输。
如果需要,您也可以实现自己的。
目前它正在加拿大和美国的所有运营商上进行生产。我希望它也能在欧盟发挥作用。
I will recommend that you use this
http://www.versatilemonkey.com/blog/index.php/2009/06/24/networking-helper-class/
We use this in our project, with some modification.
It test every transport available and take the first one that works.
You could also implement your own if you want.
It is currently working in production in Canada and USA on all Carriers. I hope it is going to work in EU too.
好吧,好吧..我很着急,我需要一个答案,所以我也在黑莓论坛上交叉发布了这个问题(我真丢脸!)。
但我在那里收到了一个非常有趣的答案,我想与您分享: peter_strange 答案
向 Peter_strange 致敬!
Ok, Ok.. I was in hurry and I needed an answer so I cross posted the question on the blackberry forum too (shame on me!).
But I received a really interesting answer over there that I'd like to share with you: peter_strange answer
Many kudos to peter_strange!
如果您知道需要支持的最常见的运营商,则可以将 APN 信息“烘焙”到您的应用程序中,这样它所需要做的就是使用 RadioInfo.getCurrentNetworkName() 然后映射将其添加到 APN 以附加到连接字符串并使用直接 TCP。
您只需要 GSM 运营商的 APN,因此 CDMA 在没有 APN 的情况下也可以正常工作。
If you know of the most common carriers you will need to support, you can "bake" the APN information into your app so that all it needs to do is check the network using something like RadioInfo.getCurrentNetworkName() and then map that to an APN to append onto the connection string and use Direct TCP.
You only need APN for GSM carriers, so CDMA should work fine without an APN.