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

New Developer
Posts: 104
Registered: ‎09-25-2013
My Device: BB 10
My Carrier: BB 10

BB 10 Cascades Internet Check

I need to check the Internet Connection If I get Socket Error. I am proceeding like this,


void Client::socketError(QAbstractSocket::SocketError socketError) {

void Client::HttpPost(QString URL ){
QNetworkRequest request = QNetworkRequest();
QNetworkAccessManager *mNetworkAccessManager = new QNetworkAccessManager(this);

bool result=connect(mNetworkAccessManager, SIGNAL(finished(QNetworkReply*)),
        this, SLOT(HttpResponse(QNetworkReply *)));

//qDebug() << result;
//printf("::: Request made to Service :::");
qDebug() << "::: Client.cpp  Request made to Service :::";

void Client::HttpResponse(QNetworkReply* reply) {

if (reply->error() == QNetworkReply::NoError) {
    qDebug() << "\n  Internet Ok **********";
} else {

    qDebug() << "\n No Internet **********" << reply->errorString();
    showDialog("No Inernet");

 and I am connecting to Signals and Slots like

connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this,


But some times I am getting "No Internet Dialog " Even If wi-fi Is Available. Why ?

any Problem in my code?

Please Help, Thanks !!!


Posts: 1,178
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: BB 10 Cascades Internet Check

Try this...


#include <bps/netstatus.h>

bool isConnected() {
    bool retVal = false;
    char* interface;

    if ( BPS_SUCCESS == netstatus_get_default_interface( &interface ) ) {
        netstatus_interface_details_t* details = NULL;
        if ( BPS_SUCCESS == netstatus_get_interface_details( interface, &details ) ) {
            switch ( netstatus_interface_get_type( details ) ) {
                    retVal = true;
            netstatus_free_interface_details( &details );
        bps_free( interface );

    return retVal;


Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.  multiFEED Icon

Play nice: Clicking Like Button on posts that helped you not only encourages others to continue sharing their experience, but also improves your own rating on this board. Also, don't forget to accept a post if it solves your problem or answers your question.