I want to be able to walk around a room with an Android device in my hand, click a button 1 and then start exploring the Bluetooth device around me and get your RSSI value. I then want to save this information as a text file. Then repeat for a different room.
This is a simple part.
The part I am having trouble with is to know that (or, if possible) to do this, strong> a timer set so that the discovery process must end itself Do not, but by the time I do not pay, I can start it and stop the search again and again ... Most of the values are usually around 5 seconds or more, which is what I am trying to do at this time, I am very happy. I got the question but there is no answer. This will be a simple example to make it a little clearer: Does anyone know that this is possible? And if so, what would be the best way? I have looked at Timer and Timersk, and they look useful. Before I started it very deeply before asking something as I did before, : Thanks You can use something like this: < / P> Repeat a variable that is set to false by the stop button. Repeats the set and the call begins (). As far as I know that Bluetooth discovery runs indefinitely, you do not have to stop it and restart it.
Private Zero Start () {mBluetoothAdapter.startDiscovery (); Handler handler = new handler (); Handler Post Delayed (New Runable) {@Override Public Zero () (if (mBluetoothAdapter.isDiscovering ()) MBluetoothAdapter.cancelDiscovery (); if (repeat) start ();}}, 5000);}
No comments:
Post a Comment