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
davidjoh0
Posts: 18
Registered: ‎12-21-2009
My Device: Not Specified
Accepted Solution

Detecting MDS access via WiFi

Hello,

 

My application uses the BES/MDS connection to reach a server inside the enterprise. The server is not routable from the internet, so I have to use the BES/MDS connection.

 

I have a "is data routable" method which checks the "data via radio" status, however if the BES/MDS connection is via WiFi (as shown Connection "Services Status") then "data via radio" is not applicable.

 

However, it is not simply a matter of detecting that there is a WiFi connection as the BES/MDS may not be reachable from the established WiFi connection.

 

So (finally) my question is whether there is a way to check how the BES/MDS connection is established (Wifi or mobile network) so that I can included this in my "is data routable" method.

 

Many thanks,

 

David Johnson

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Detecting MDS access via WiFi

use the CoverageInfo class

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
davidjoh0
Posts: 18
Registered: ‎12-21-2009
My Device: Not Specified

Re: Detecting MDS access via WiFi

many thanks for the suggestion.

 

I originally used: CoverageInfo.isCoverageSufficient(COVERAGE_MDS); in my "is data routable" method however I found this API to be unrealiable in the 4.2.1 BB OS, e.g. it would return false even though there was MDS coverage.

 

Are you suggesting I use something more like:

 

CoverageInfo.isCoverageSufficient(COVERAGE_MDS, RadioInfo.WAF_WLAN,true);

 

to specifically check the WiFi MDS access?

 

Many thanks,

 

Dave

 

Developer
yyzTim
Posts: 304
Registered: ‎04-30-2008
My Device: Not Specified

Re: Detecting MDS access via WiFi

I don't believe the MDS check will work in a simulator so if that is where you are noticing unreliability you should test on a live device.  With that said on a small minority of devices I have noticed that the MDS check would work until you turn off your connection, but when you turn your connection back on the device would not re-detect MDS without a restart.  I had thought I had it figured out but apparently I was wrong and the problem returned.

 

Until I get it figured out I go with something similar to the following (which I more or less robbed from a kbase article originally I think).  Doesn't check for MDS but it is pretty good.:

if ((RadioInfo.getState() != RadioInfo.STATE_OFF && (RadioInfo.getNetworkService() & RadioInfo.NETWORK_SERVICE_DATA ) != 0)){
    return true;
}else{
    return false;
}

 

 

 

Contributor
SergeyAYakovlev
Posts: 10
Registered: ‎09-21-2011
My Device: BlackBerry 9900

Re: Detecting MDS access via WiFi

[ Edited ]

Hi guys, 

can I please open/up! this topic. Do you have any ideas why in the Wi-Fi enabled device with the only Wi-Fi established BlackBerry data services connection  (without mobile network) the 3rd party app cannot connect to internal server using MDS ? I read this guide http://supportforums.blackberry.com/rim/attachments/rim/java_dev@tkb/397/1/Network_Tranports_tutoria... and according it.. the device must select MDSoverWi-Fi option automatically.. if app wants to connect throught MDS.

 

No special IT policies (everything seems to be opend/allowed) from BES on this device. I tried 9700/9790/9900 (and different OSs - from OS5 to OS7.1).

 

We use "deviceside=false" parameter & nothing else. I can provide any additional information from this 3rd app's source code if needed. 

 

Thank you in advance.

 

and 3 more things:
1) MDS connection (to internal resource) over Mobile network works without any problem using this app. 

2) I can open this internal resource using BlackBerry Browser in the Wi-Fi only mode (without Mobile network)

3) This tool

 http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is... also makes the failed result than I try to open Internet/Internal resources in Wi-Fi only mode (of course, Internet resourse like google.com works in Wi-Fi HTTP & Socket test, but MDS completely failed - both for internal & external recources)

 

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

Re: Detecting MDS access via WiFi

Be aware that I am not a RIM employee and have no knowledge regarding the internals of the OS over that which is supplied by the documentation. 

 

The MDS connection over WiFi does not happen automatically.  As I understand it, the device will establish a wireless (non WiFi) connection the the MDS Server first.  It will then attempt to establish connection to the same MDS Server over WiFi.  I will start using the WiFi route when it is 100% sure that the WiFi route takes it to the same MDS Server. 

 

You can actually see this on the device at least one with OS 5.0 or earlier. Turn WiFi and wireless off.  Then turn both on.  You will see the WiFi shield come up immediately, but it will be 'grey' or silver, i.e. appear less obvious.  Once the connection the the MDS has been established, the symbol will become white or brighter.

 

I presume there is some similar indication on the from screen of a OS 6.0 and above device, but I have never looked for it. 

 

If you are looking for service books, the WiFi Service Book becomes 'enabled' at that point'.

 

So if you turn WiFi and wireless off and only turn WiFi back on, the device can not go through the process of authenticating the DES and so will not establish a deviceside=false connection.

 

Interestingly, once you have established a connection, you can turn wireless off and still get data like emails and so on.  No calls mind....

 

Hope this answers the question. 

 

BTW, when you say this "BlackBerry Browser in the Wi-Fi only mode " are you sure you are using the Blackberry browser (and not the WiFi browser)?  What level of OS are you using on the device?

Contributor
SergeyAYakovlev
Posts: 10
Registered: ‎09-21-2011
My Device: BlackBerry 9900

Re: Detecting MDS access via WiFi

peter_strange,

thank you for you reply.

 

Yes, you're right about "the symbol will become white or brighter.".

In OS6-OS7.1 the icon was changed and if Wi-Fi is OK and BlackBerry smartphone connects to BlackBerry Infrastructure, the iconset is the follow:

(http://docs.blackberry.com/en/smartphone_users/deliverables/38289/Wireless_coverage_indicators_71_17...



 

So, I just talked about this situation - I call it "Wi-Fi only mode":

- Mobile network: OFF

- Wi-Fi: ON & connected

- BlackBerry Data Services work through Wi-Fi network (BlackBerry device successfully connects to the BlackBerry Infrastructure:  "the symbol will become white or brighter" in OS5 and OS6-7.1 show the "BlackBerry" icon near the Wi-Fi icon) - e-mail & browsing work through MDS over Wi-Fi without Mobile Network (I can send/receive corporate mails, open internal corporate web resources, which are not available from Internet using Blackberry Browser etc).

 

Acording to the http://supportforums.blackberry.com/t5/Java-Development/Networking-Transports-II/ta-p/446742?name=Ne... (Network Transports PDF):

 

 


 

"All BlackBerry devices using Wi-Fi can connect to a consumer (public) or corporate Wi-Fi access point or Router. 
Consumer (public) access point is connected directly to the Internet (...). If Wi-Fi is available and MDS transport is selected by application then the device will automatically use this connection if it has a way to connect to the BES.In the case of consumer access point, the device will connect to BlackBerry Infrastructure and it will find its way to connect to BES. As seen on the image, the carrier's infrastructure is avoided and since there is usually no charge for using Wi-Fi, this connection is ideal for large data transfers. 

Important: There is no way to programmatically request a connection to BES over Wi-Fi.You can ask for a BES connection and the device will automatically decide what is the least cost 
route to use. If you explicitly request a Wi-Fi connection, you will get a Wi-Fi connection to the Internet only, avoiding BlackBerry Infrastructure, and hence no connection to the BES server. "


So, everything should work automatically... 

 

But neither our 3rd party app, nor Network Diagnostic Tool - these apps can't use MDS in the Wi-Fi only mode.. 

 

I found only one App - Bloomberg (http://m.bloomberg.com/bba/blackberry/) - it shows that MDS route works/available when I run its (Bloomberg's app) Route Tester in the "Wi-Fi only mode".

 

Do you have any ideas? Have you ever use/develop any app which can use MDS (BES) in the "Wi-Fi only mode" ? Could you please try on your device the Network Diagnostic Tool (http://www.blackberry.com/knowledgecentersupport/kmsupport/developerknowledgebase/zip/NetworkDiagnos...)in this mode & provide me the result ?

 

Thanks.

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

Re: Detecting MDS access via WiFi

Sorry I am not sure I understand what you want me test. 

 

In my memory (and I think I have actually tested this), if you have an application that only uses ";deviceside=false", then that application will work over WiFi, if the WiFi symbol is bright.  You can, once the WiFi is bright, turn off the mobile connection and it will still work. 

 

However the WiFi symbol will never become bright if you restart the device with wireless turned off.  So you can't start the device is WiFi only mode. You have to have established a connection to the BES via wireless before you go into WiFi only mode. 

 

So can you describe to me what you want me to test?

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

Re: Detecting MDS access via WiFi

[ Edited ]

Interesting.

 

Done some more testing.

 

The bright WiFi is not an indication of connectivity to BES.  As you will see, I have disconnected our BES and restarted my OS 5.0 BES connected device and I still getting the dull WiFi symbol, followed after a short time by the bright one.  So I am not sure what this means.

 

On this device I have run the following tests with my own proggram which only uses ";deviceside=false"

 

a) wireless and WiFi enabled, with a bright WiFi symbol - worked, as did BlackBerry Browser

b) Same as above, disabled WiFiwireless, worked, as did BlackBerry Browser

c) Restart device with only WiFi active, got bright WiFi symbol, worked, as did BlackBerry Browser

d) Restarted device with BES doconnected (pulled cable out so positive it is not talking to anything), got bright WiFi, my program can't connect, neither can Blackberry Browser.

e) Plugged BES back in, waited a short period, tested again, failed, as did BlackBerry Browser

f Waited a couple of minutes more, worked, as did BlackBerry Browser.

 

There are two differences here to the process I thought happened

1) Bright WiFi does not mean connection to BES

2) The device does not need to authenticate over wireless

 

I woudl treat this test with some caution, since I am actually on the same network as the BES.  I think this might be how it can authenticate the BES without needing a wireless connection first.  But not sure. 

 

But I think what I can say with certainlity is that my device correctly connects to the internet using ";deviceside=false" in a WiFi only situation.

 

Edit:  Corrected point (b) above.  Originally it said I disabled WiFi, I meant wireless.

Contributor
SergeyAYakovlev
Posts: 10
Registered: ‎09-21-2011
My Device: BlackBerry 9900

Re: Detecting MDS access via WiFi

peter_strange,

if I wrote that "bright Wi-Fi icon" - is the BES connected status I was not accurate when wrote it.

 

This icon (and the new 2 icons for OS6-7.1) only show connecting to BlackBerry Infrastructure (RIM BB infrastructure). Nothing more. 

BTW: if you use BIS also (BES+BIS) you'll see in your tests that BIS works well. 

 

Look there: 

http://docs.blackberry.com/en/smartphone_users/deliverables/38289/Wireless_coverage_indicators_71_17...

OS5 PDF only file, p. 22: 

http://docs.blackberry.com/en/smartphone_users/deliverables/11208/BlackBerry_Bold_9700_Smartphone-Le...

 

So, if we return to the main question, your two tests b) and c):

b) Same as above, disabled WiFi, worked, as did BlackBerry Browser
c) Restart device with only WiFi active, got bright WiFi symbol, worked, as did BlackBerry Browser

 

show that you're successfull on MDS over Wi-Fi connection using your app.. And I confused - because I can't solve that... This is my open question :-(