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

Native Development

Reply
Developer
amardeepjaiman
Posts: 293
Registered: ‎02-25-2009
My Device: Not Specified

How to get network status

Hi,

 

In My application a functionality is like this that a listener to be implemented whenever device gets connected to mobile network or switched to wifi network or vice-versa . Has  anyone tried that or have an idea that how it can be implemneted using BB 10 NDK ?

 

Thanks,

Amardeep

BlackBerry Development Advisor (Retired)
mgoulet
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha

Re: How to get network status

Hi,

 

Have you looked at the API? This may point you in the right direction:

 

https://developer.blackberry.com/cascades/reference/bb__system__networkstatus.html

 

Martin

 

Developer
torpesco
Posts: 121
Registered: ‎01-29-2011
My Device: Z10, PlayBook

Re: How to get network status

What's considered best practice when using this? I can tell that if wifi is on, "up" returns true on the interface, and if it's actually connected then "connected" returns true as well... but is it acceptable to count on "tiw_sta0" to be the wifi device? When connected, tiw_sta0 is the default interface, so simply seeing if that's the case might be sufficient.

 

Anything to be aware of, or should I be ok with just checking the default interface?

 

Thanks.