android - To check whether the wifi scan is complete -


i'm writing code getting information of access points in range continuously.

here code:

       myrunnable = new runnable() {        @override public void run() {        while(){        wifi = (wifimanager) getsystemservice(context.wifi_service);         wifi.startscan();         list<scanresult>results= wifi.getscanresults();         try{           //data logging             }              }           }          };        mythread = new thread(myrunnable);       mythread.start(); 

as scanning , logging of data continuous repeatedly, want check whether scan complete before logging data. there flag or function checks wifi.startscan() complete or not , before logging data. please me out code.

i want check whether scan complete before logging data. there flag or function checks wifi.startscan() complete or not , before logging data. please me out code.

yes, there mechanizm designated purpose. reach goal need implement broadcastreceiver listen wifi scans.

all need create broadcastreceiver appropriate intentfilter. need action filter:

wifimanager.scan_results_available_action 

this action means access point scan has completed, , results available. , create broadcastreceiver (statically or dynamically, it's doesn't matter).

if don't know how start, @ tutorial:


Comments