开发者

Blackberry java.io.IOException radio is off

开发者 https://www.devze.com 2023-02-15 18:59 出处:网络
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

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.


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();
            }
        } }
0

精彩评论

暂无评论...
验证码 换一张
取 消