开发者

How to broadcast and receive every 5 seconds?

Basically I want to broadcast and receive every 5 seconds using this code:

    private final BroadcastReceiver checkWifiStateChanged = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {    
            checkWifiSt开发者_高级运维ateHasChanged();

        }
    };

How could I do this?


As the comments have stated, this is basically an unnecessary way to approach this. The Android platform automatically sends out Intents for certain changes, and Wifi status is one of them. You need only have a BroadcastReceiver registered that filters on that Intent to be able to respond to it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜