Goal:

Run startDiscovery() in a separate method which will wait/block until
the discovery finishes and then return a list of all available
devices.

Problem:

We have a seperate API package declared as a basic java project in
eclipse which imports the android jar.  From an actual android project
we call something like ListOfDevices =
ourProject.internalBtDisco(this.context).  Inside of internalBtDisco
we have started a discovery exactly as shown in the android bluetooth
tutorial and it works fine, we can see the DEVICE_FOUND and FINISHED
events firing.  The events are also captured by our broadcastReceiver
just fine, until however we try and block on some object.

For example we block on the collection that is storing the devices
found in a sync block with wait.  Then we want to notify the object
when we receive the FINISHED event so we call notify() on it.  The
problem is that the moment we try to block, our broadcastReceiver no
longer receives any of the events being fired.  They still get fired
off (we see them in logcat) but they never make it to the receiver.

We have tried to remedy this issue by moving the discovery into an
asyncTask and by simply creating our own thread but nothing has
helped.

Question:

Is what we are attempting to do possible?  We spent quite a bite of
time on it today and every attempt resulted in the same failure.  This
may seem to be an odd request but we have an API for most other mobile
platforms and wish to keep them the same as much as possible, and in
each other project we have simply blocked on discovery until it has
finished.

Assumption:

Our broadcastReceiver is somehow being lost when we enter the sync
wait block (or itself being blocked, even though it is in the
asyncTask that is calling startDiscovery()) and when the events fire
they no longer have a correct destination.

Any suggestions?

-- 
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

Reply via email to