5 pts.
 Continuous Bluetooth Inquiry J2ME
I'm trying to develop a midlet that will continuously inquiry for nearby devices. I want to test if it's possible to inquiry a device while he is inquiring too. I have done this continuous inquiry by doing an initial startInquiry and then calling the startInquiry again inside the inquiryCompleted event handler. After this i encountered two problems. The first was in the mobile emulator. The first inquiry doesn't give an error, but after that i get "BluetoothStateException: The previous device discovery is running". When i try this in the actual device (my personal cellphone) it doesn't throw an exception but it doesn't do anything else. It blocks on the startInquiry (the second one) and does nothing. The interface continues to work (since it blocked the thread of the event handler, i think). I've tried several solutions like calling cancelInquiry before the new startInquiry. I tried also (at least on the emulator) to put a delay before calling the next startInquiry. How do i do this?

Software/Hardware used:
ASKED: July 9, 2008  9:49 AM
UPDATED: April 22, 2009  9:22 PM

Answer Wiki:
Do you implement deviceDiscovered as a useful method, or just as a stub? I would think that once a device is discovered, this would be the time to make another call to startInquiry (after getting whatever info you want about the device, of course). Also: startInquiry is supposed to be non-blocking. If it is blocking, there may be some other problem somewhere. If you want to do more than one inquiry at the same time, I would think that you would need to do these on two separate threads of execution using a class that implements Runnable. Have you tried that? Also: what is the point of doing overlapping queries? BTW, how long was your delay? I'd start with a one minute delay and then work down to the lowest possible number. I would think a delay of some length would have to be incorporated, otherwise you would drain the battery of a real device fairly quickly.
Last Wiki Answer Submitted:  April 22, 2009  9:22 pm  by  Berryinnovative   15 pts.
All Answer Wiki Contributors:  Berryinnovative   15 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _