I think you are looking for BroadcastReceiver (More info @ http://code.google.com/android/reference/android/content/BroadcastReceiver.html ) . Try something like this in your application's onCreate() ...
// -- Sample WiFi implementation IntentFilter i = new IntentFilter(); i.addAction (WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); registerReceiver(new BroadcastReceiver(){ public void onReceive(Context c, Intent i){ // Code to execute when SCAN_RESULTS_AVAILABLE_ACTION event occurs WifiManager w = (WifiManager) c.getSystemService (Context.WIFI_SERVICE); w.getScanResults(); // Returns a <list> of scanResults } }, i ); // Now you can call this and it should execute the broadcastReceiver's onReceive() WifiManager wm = (WifiManager) getSystemService (Context.WIFI_SERVICE); boolean a = wm.startScan(); // -- End Wifi Sample NOTE: I don't think wiFi stuff works in the emulator, and you must set the correct Wifi permissions in your Application's manifest for it to work on an actual device. -K On Dec 9, 2:44 pm, Ian <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I want to write an app that scans for WiFi networks and displays their > signal strengths, continually updating. It seems like a no-brainer to > use android.net.wifi.WifiManager.startScan() and get the results; but > how? > > startScan() says: "The availability of the results is made known later > by means of an asynchronous event sent on completion of the scan". How > do I get this asynchronous event? I can't see any API to register a > listener. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---