I don't think it's doing any blocking operations at all since startScan
calls back onReceive rather quickly (even on a G1), and then I just use the
returned SSID data to call back to the activities bound to the service based
on the existence of a pre-determined SSID that I'm trying to find in that
list.
So in essence, you want me to do the following:
Create Handler object and then within my BroadcastReceiver's onReceive
method, do the following:
final int DO_WIFI_SCAN = 0;
private Handler _handler = new Handler(){
@Override
public void handleMessage(Message msg){
switch(msg.what){
case DO_WIFI_SCAN:
//call startScan here
break;
}
}
};
public void onReceive(){
//Iterate through the SSID's
_handler.sendEmptyMessageDelayed(DO_WIFI_SCAN, SLEEP_TIME);
}
Also, how would I model it if I try to use the HandlerThread approach? In
other words, where would I call startScan when starting thread, in run or in
the HandlerThread's constructor?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en