Query a radio's availability and change its status
You can use the
RadioInfo and
Radio classes to determine whether a particular radio
technology is supported on a
BlackBerry® device,
and to turn on or turn off the radio. For more information, see the API
reference for the
BlackBerry® Java® SDK.
-
Import the required classes and interfaces.
import net.rim.device.api.system.Radio;
import net.rim.device.api.system.RadioInfo;
-
Retrieve a bit field of supported wireless access families.
int intSupportedWAFs = RadioInfo.getSupportedWAFs();
-
Check if the wireless access family that you want to use is
available on the device. Perform a bitwise AND operation that combines the
intSupportedWAFs bit field and the constant for the
wireless access family that you want to use. If the family is available, the
result will be nonzero.
if ((intSupportedWAFs & RadioInfo.WAF_WLAN) !=0 )
{
-
Retrieve a bit field of available radios.
int intSupportedWAFs = RadioInfo.getSupportedWAFs();
int intActiveWAFs = RadioInfo.getActiveWAFs();
-
Check if the radio that you want to use is turned off. If it is
turned off, a bitwise AND operation applied to
intActiveWAFs and the constant for the radio returns
0.
if ((intActiveWAFs & RadioInfo.WAF_WLAN) = 0)
{
-
If the radio is turned off, then turn it on.
Radio.activateWAFs(RadioInfo.WAF_WLAN);
}
}
Was this information helpful? Send us your comments.