views:

42

answers:

3

Hallo, developing a bb app I need to make http connections to get files, images etc. In simulator all works, but not in device. I bought a BlackBerry but I want to test my app without a sim then without a bes.

How do I need to set my device? and how do I have to compose my url?

I just have a bb device with wifi available

Thanks all :)

Sergio

A: 

what lang do you develop your bb-app in?

santa
sorry :) JAVA with eclipse
Sergio Andreotti
I have not a data plan... connection in my company is served by swisscom in switzerland. so I tested in my urls: myurl+";deviceside=true" and in settings I ve activated apn with gprs.swisscom.ch but nothing...
Sergio Andreotti
ok... hope someone else can help you with java...
santa
A: 

Try appending ";interface=wifi" onto the URL when using a device (instead of ";deviceside=true"). This will force a Wi-Fi connection (assuming the device has Wi-Fi).

Marc Novakowski
I tried all... not working... deviceside=true interface=wifi...now I 'm trying to debug on device but I'm getting the error net_rim_cldc and net_rim_os ...
Sergio Andreotti
Make sure you are compiling with a JDE (or Eclipse plugin) that's either the same version as the OS on your device, or lower. For example if your device is running 4.5 OS you can't compile with a 4.7 or 5.0 JDE and expect it to run on the device.
Marc Novakowski
ok now I'm able to debug on my device, but I'm still getting problems with http connections...
Sergio Andreotti
Marc Novakowski
+1  A: 

As answered for this duplicate question...

This was a tough one for me! As Mark said you have to put some parameters in the url to make it work on the device. You shouldn't do it by hand but use the ConnectionFactory instead.

As you may thing this would just make it work but it doesn't!

The real problem is that not the url has been altered because it has ;interface=wifi;deviceside=true in it (in my case). Depending on the webserver accepting your request this could broke the code.

A solution I tried and that works is try to happend a fake parameter like

&foo=true -> &foo=true;deviceside=true

This will result as a standard parameter for the webserver but your device would use it to driver your connection.

On the simulator this work without this extra code because behind it there is a BIS server for you. On the device (as in my case) there isn't because I'm using a development device unregistered and without SIM (just wifi).

Another point is that the HttpConnection class doesn't handle HTTP 302 Redirect and if you get one you have to handle it manually.

Davide Vosti