Re: [android-developers] Re: Scan wireless networks periodically

2010-05-29 Thread Kostya Vasilyev

Note that sometimes Android initiates a scan on its own.

So if you listen for broadcast SCAN_RESULTS_AVAILABLE, make sure your 
code is able to handle it anytime, not just initiated from your app.


29.05.2010 5:09, Charly пишет:

Thank you for the replies. Finally I decided to implement a Handler
object and it works fine.

   



--
Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Scan wireless networks periodically

2010-05-29 Thread Lee
Also note that on Froyo you never get SCAN_RESULTS_AVAILABLE (or,
after a longer timeout than I wanted to hang around for) if there are
no APs nearby whereas previously you did.

Lee

On May 29, 11:27 am, Kostya Vasilyev kmans...@gmail.com wrote:
 Note that sometimes Android initiates a scan on its own.

 So if you listen for broadcast SCAN_RESULTS_AVAILABLE, make sure your
 code is able to handle it anytime, not just initiated from your app.

 29.05.2010 5:09, Charly пишет:

  Thank you for the replies. Finally I decided to implement a Handler
  object and it works fine.

 --
 Kostya Vasilev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Scan wireless networks periodically

2010-05-28 Thread ionel
Hi,

Use alarms

On May 26, 8:06 pm, Charly carlos.per...@gmail.com wrote:
 Hi,

 I'm developing sort of a wireless scanner, so I need to scan every X
 seconds.

 I know I should use WifiManager and startScan() to get the networks
 and then register a receiver to receive the event once the scan has
 finished. However I'm having problems when trying to figure out how to
 scan periodically. It's more like a design problem.

 My solution so far has been to create a Service which takes care of
 the scanning, besides the main Activity. I think this is correct. So
 how could I tell this Service to scan every X seconds? I've thought it
 may have a Thread object, call its Scan method during tart_services()
 and then take it to sleep. Also I thought I could just get rid of the
 Service and run the Thread from the main Activity, but then I guess it
 would die whenever the Activity is not visible. None of then seem like
 a really good solution to me, and I think there must be an easier way
 to do this.

 Could anyone help me please?

 Thanks in advance.

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Scan wireless networks periodically

2010-05-28 Thread Charly
Thank you for the replies. Finally I decided to implement a Handler
object and it works fine.

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Scan wireless networks periodically

2010-05-27 Thread Vinay S
Hi,

Look at timers...

-Vinay

On May 26, 10:06 pm, Charly carlos.per...@gmail.com wrote:
 Hi,

 I'm developing sort of a wireless scanner, so I need to scan every X
 seconds.

 I know I should use WifiManager and startScan() to get the networks
 and then register a receiver to receive the event once the scan has
 finished. However I'm having problems when trying to figure out how to
 scan periodically. It's more like a design problem.

 My solution so far has been to create a Service which takes care of
 the scanning, besides the main Activity. I think this is correct. So
 how could I tell this Service to scan every X seconds? I've thought it
 may have a Thread object, call its Scan method during tart_services()
 and then take it to sleep. Also I thought I could just get rid of the
 Service and run the Thread from the main Activity, but then I guess it
 would die whenever the Activity is not visible. None of then seem like
 a really good solution to me, and I think there must be an easier way
 to do this.

 Could anyone help me please?

 Thanks in advance.

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en