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
tanphat1412
Posts: 123
Registered: ‎11-06-2012
My Device: BlackBerry
My Carrier: Mobifone
Accepted Solution

Check the Wifi signal with "wifi_get_status"

This is the snipet code I use to check the wifi signal, it's right at fist time, but now it's away show ON even i turn off the wifi. Please help me with this problem. Thanks.

bool checkWifi(){
	wifi_status_t status = WIFI_STATUS_RADIO_ON;
	int i = wifi_get_status(&status);
	if (i == 0)
		return true; // Wifi On
	return false; // Wifi Off
}

 

Please use plain text.
Developer
jalue
Posts: 196
Registered: ‎03-04-2013
My Device: BB Z10
My Carrier: Rogers

Re: Check the Wifi signal with "wifi_get_status"

[ Edited ]

Hey there...

 

You are checking the wrong value...

 

bool checkWifi() {
    wifi_status_t status;

    if (WIFI_SUCCESS == wifi_get_status(&status)) {
        if (status == WIFI_STATUS_RADIO_ON) {
            return true;
        }
    }
    return false;
}

 

Please use plain text.