Blackberry java.io.IOException radio is off

扶醉桌前 提交于 2019-12-24 12:12:24

问题


I am trying to connect my device to a http server using wifi. But I am having this exception:

java.io.IOException radio is off

What is usually the cause of this and what should I check for?

Thank in advance.


回答1:


I've never had this error so I can't be sure. However it sounds as if your wifi reciever is turned off, try the following code.

if (RadioInfo.getState() == RadioInfo.STATE_OFF) {
        if (Dialog.ask(Dialog.D_YES_NO, "You currently have no network connection\nDo you want to turn connections on?", Dialog.YES) == Dialog.YES)
        {
            //Activate GPRS
            Radio.activateWAFs(RadioInfo.WAF_3GPP);

            //Sleep for 10secs to allow wireless to activate. 
            // TODO (DG) DO THIS IN NEW THREAD TO PREVENT BLOCKING UI THREAD
            try {
                Thread.sleep(10000);
            }
            catch (InterruptedException e) {
                e.printStackTrace();
            }
        } }


来源:https://stackoverflow.com/questions/5257063/blackberry-java-io-ioexception-radio-is-off

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!