So I have an application that scans the available wifi networks, and if it finds the specific one it's looking for (which is saved in shared preferences) it will automatically connect to it and open a TCP socket for comms.
At the moment the code listening for incoming messages on the socket runs a continuous while loop checking if there is data in the BufferedReader, which seems inefficient but is done in all the examples I've seen. Is there a way to configure a broadcast intent or message (or some other API), which when the Android OS recognises there is data coming in on that socket, (and is terminated by a carriage return line feed) will send out an intent or message which I can listen for and then decide to act on, rather than just constantly polling the BufferedReader and wasting CPU time? Thanks. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/804c0bf9-5816-44a8-a5ce-623b2db9dc03%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

