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
Highlighted
New Developer
Posts: 44
Registered: ‎06-28-2012
My Device: All
My Carrier: Vodafone

BB10- Network availability checking always returning false

[ Edited ]

I have used the following sniped of code in cpp file, to check internet connection in simulator. But it is always returning false eventhough I have inernet in the simulator.

 

QNetworkConfigurationManager netMgr;
    QList<QNetworkConfiguration> mNetList = netMgr.allConfigurations(
            QNetworkConfiguration::Active);
    if (mNetList.count() > 0) {
        if (netMgr.isOnline()) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }

I have added QT += network in .pro file.

 

Please help me regarding this

Developer
Posts: 161
Registered: ‎01-03-2013
My Device: n/a
My Carrier: n/a

Re: BB10- Network availability checking always returning false

Well, If you check Settings > Network Connections you'll see everything is off,  that's the cause of getting false from the isOnline method. The internet hability on the simulator is probably some kind of workaround.

Regards.

If my answer has been useful to you, please, click the button
New Developer
Posts: 44
Registered: ‎06-28-2012
My Device: All
My Carrier: Vodafone

Re: BB10- Network availability checking always returning false

[ Edited ]

@MagnumOpus- For samples which are downloaded from Blackberry site are able to connect to net work and working fine. But my application only not able to connect to net work . Please give me any idea on this

BlackBerry Development Advisor
Posts: 15,813
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: BB10- Network availability checking always returning false

Open the bar-descriptor.xml for your application and click on the Application tab.  Under Permissions, make sure you have checked the Internet permission.  If not, your application will not be able to access the network.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.