Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Developer
Posts: 283
Registered: ‎07-22-2008
My Device: Not Specified

Connection using WI-FI failing

My application which is built using 4.2 is trying to connect using wi-fi on a Bold device.

if I append ";interface=wifi" to the URL I get an exception saying " Tunnel Failed".

If I append ";device=true;interface=wifi" the I get an exception saying " Bad Tunnel".

 

Does anyone knows what is going on.

Can I connect using WI-FI if my application is compiled on a 4.2 version?

 

( by the way, this bold has a WI-FI service and I am able to connect using the browser).

 

Thanks

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Connection using WI-FI failing

I haven't specifically tested with 4.2, but I can confirm that in the UK, a Bold will talk Wi-Fi using code complied in 4.0, and 4.1 and 4.2.1, that has ";interface=wifi" (and no ";deviceside=true").

 

In my testing, this works (i.e. interface=wifi connects) even when the Bold has no SIM card.

 

Can you confirm that you are using the WiFi Browser be disabling the network, the trying the Browser again?

Developer
Posts: 85
Registered: ‎12-05-2008
My Device: Blackberry 8900 Javelin

Re: Connection using WI-FI failing

I have never got the ;interface=wifi to work Smiley Sad so i instead scan service books for WPTCP cids and look for any name with "wi-fi" or "wifi" in it (and valid and not disabled) and use that as the connection string, e.g. ;deviceside=true;ConnectionUID=<uid-from-service-book> 

 

Hope this helps.

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Connection using WI-FI failing

@robinShazam

I think the Service Records you are finding are for WAP 2.0 Service Records.  This process is explained in this post.

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=8745#M8745

and in this KB article

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...

Developer
Developer
Posts: 283
Registered: ‎07-22-2008
My Device: Not Specified

Re: Connection using WI-FI failing

Thank you all for your responses.

 

Finally I got it working by reconfiguring the Wi-Fi network, by deleting the old info and doing a new set-up.

But what was weired is that the BB browser was working all the time.

 

I am scanning the records returned by:

 

serviceRecords = serviceBook.findRecordsByCid("WPTCP");

 

for a record that has "Wi-Fi" as part of its name:

 

if (recordName != null && recordName.startsWith("Wi-Fi"))

 

However the test for:

 

if ( serviceRecord.isDisabled())

 

is always returning true. Does this mean that all records are disabled?

I had to comment out this test for it to work.

 

Thanks

 

Developer
Posts: 85
Registered: ‎12-05-2008
My Device: Blackberry 8900 Javelin

Re: Connection using WI-FI failing

[ Edited ]

Hmmm I always obey the "disabled" flag. I personally wouldn't ignore it. My wi-fi is shown as enabled in the service book (on an 8120 and 8900) and remains enabled even if i switch off the wi-fi (so the service book does not appear to rely on the wi-fi on/off switch). Did you try a hard reset to see if the service book entry reports itself as enabled?

 

*edit: i thought i read somewhere (no link to hand though) that wi-fi was added in 4.2.1. We don't support it for 4.2 - maybe the 4.2 OS also does not like the look of the wi-fi service book hence it being disabled?

 

 

 

Message Edited by robinShazam on 01-20-2009 05:32 PM
Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Connection using WI-FI failing

@robinshazam.  As a test, pull the SIM card out of one of your WiFi devices, then power it up and see if the Browser still works.  In this situation, see if the WiFi Service book is marked as disabled.  If my experience si anything to go by, it will work and the Service Book will be disabled.
Developer
Developer
Posts: 283
Registered: ‎07-22-2008
My Device: Not Specified

Re: Connection using WI-FI failing

This is hapening on two Bold ( 9000) devices, but the code is compiled using 4.2.

So by just finding a service book record with wi-fi, I assume that there is a possibility to connect using wi-fi.

I issue a connection using wi-fi and if it fails, I try the other possibilities.

Since there is no way to detect if the wi-fi is configured and active or not.

This is an expensive way to find out if the wi-fi is enabled or not.

 

 

Thanks

 

Developer
Posts: 85
Registered: ‎12-05-2008
My Device: Blackberry 8900 Javelin

Re: Connection using WI-FI failing

@peter_strange: i can confirm that on an 8120 and 8900 - each with no SIM - the wifi service book is disabled but wifi is still accessible from the browser.

 

I can also confirm that [with no sim] the 4.2.1/4.2.2 wifi check (below #1) and 4.3+ wifi check (below #2) return true so the phone does state that wifi is active and ready to use. This probably wont help 4.2 developers.

 

I really don't want to ignore the "disabled" flag for wifi service books but the disabled flag doesn't match the real state of wifi when there is no SIM. Hmmm...

 

 

#1: wifi check 4.2.1 & 4.2.2

public boolean isWifiActive(){ return (RadioInfo.getActiveWAFs() & RadioInfo.WAF_WLAN ) != 0; }

 

#2: wifi check 4.3+

public boolean isWifiActive(){ return WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED; }

 


 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Connection using WI-FI failing

I think hmmm about sums it up. ...