I'm trying to display all the available Eddystone beacons in my app.I have two eddystone for testing this app.when i open app,It's scann beacons and display duplicated values like attached image..i want to show both beacons sametime when i open the app (-57 beacon and -69 beacon ).I'm using below code.
i have initialize these Arraylist on top
txpowerArray= new ArrayList<String>();
urlArray=new ArrayList<String>();
private BluetoothAdapter.LeScanCallback mLeScanCallback =new BluetoothAdapter.LeScanCallback() {
@Override
public void onLeScan(final BluetoothDevice device,final int rssi,final byte[] scanRecord)
{
new Thread()
{
public void run()
{
RangingActivity.this.runOnUiThread(new Runnable()
{
public void run()
{
connect(rssi, scanRecord,device);
}
});
}
}.start();
}
};
public void connect(int rssi, byte[] scanRecord,BluetoothDevice device){
List<ADStructure> structures =
ADPayloadParser.getInstance().parse(scanRecord);
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
for (ADStructure structure : structures)
{
if (structure instanceof EddystoneURL)
{
EddystoneURL es = (EddystoneURL)structure;
Log.d("Eddy", "Tx Power = " + es.getTxPower());
Log.d("Eddy", "URL = " + es.getURL() );
clickUrl=es.getURL().toString();
txpower=String.valueOf(es.getTxPower());
txpowerArray.add(txpower);
urlArray.add("" + clickUrl);
Log.d("devicelist", " "+url+" "+txpower);
mBluetoothAdapter.stopLeScan(mLeScanCallback);
}else {
}
}
}
}, 4000);