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
Posts: 82
Registered: ‎01-11-2013
My Device: DevAlphadevice
My Carrier: rim
Accepted Solution

network status of device

Hi all,

 

I am using sample app network status to check device connected to which network ,but i have issue that i swiched off the all bluetooth vpn,wifi,in device then also am getting status as true, so plz help me how chk whether device connected to wifi or sim netwok plz reply me

Developer
Posts: 145
Registered: ‎12-23-2012
My Device: BB10 Dev Alpha
My Carrier: wifi

Re: network status of device

did you tried "QNetworkConfigurationManager" ?

 

void QNetworkConfigurationManager:Smiley SurprisednlineStateChanged(bool isOnline) [signal]

 

http://developer.blackberry.com/cascades/reference/qnetworkconfigurationmanager.html

 

Regular Contributor
Posts: 75
Registered: ‎11-30-2012
My Device: curve
My Carrier: airtel

Re: network status of device

Use APIs from 

#include<bps/netstatus.h>

 

netstatus_interface_details_t *details;

netstatus_get_interface_details(NULL, &details);

int c = netstatus_interface_get_num_ip_addresses(details);

 

constchar *  wifi = netstatus_interface_get_link_address(details);

 

bool netAvail = false;

netstatus_get_availability(&netAvail);

 

Developer
Posts: 217
Registered: ‎09-18-2009
My Device: Z10
My Carrier: O2

Re: network status of device

To check if a network connection is available you could do the following.

 

QNetworkAccessManager manager;
if (manager.networkAccessible() == QNetworkAccessManager::Accessible) {
    // Accessible
}

 

Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: network status of device

This code always return false in the simulator:

 

QNetworkAccessManager manager;
m_networkStatus = (manager.networkAccessible() == QNetworkAccessManager::Accessible);

Regular Contributor
Posts: 75
Registered: ‎11-30-2012
My Device: curve
My Carrier: airtel

Re: network status of device

Should work on device...  since on simulator in settings page we cannot switch on wifi, that could be the issue..

Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: network status of device

Thanks a lot !!!!