Skip to content

DiscoverDevicesSample  #168

@shanif3

Description

@shanif3

Hi,
I added the code to my android studio app like this:

part of the code where i add the relvant part of discovering:

try {

// Open the connection with the device.
xbeeDevice.open();
try{
    XBeeNetwork myXBeeNetwork = xbeeDevice.getNetwork();
    myXBeeNetwork.setDiscoveryTimeout(15000);
    myXBeeNetwork.addDiscoveryListener(new MyDiscoveryListener());
    myXBeeNetwork.startDiscoveryProcess();
    Log.d("yes", "\n>> Discovering remote XBee devices...");

}catch (Exception e) {
    e.printStackTrace();
    throw new RuntimeException(e); }

package com.digi.xbee.sample.android.bleconfiguration;

import android.util.Log;

import com.digi.xbee.api.RemoteXBeeDevice;
import com.digi.xbee.api.listeners.IDiscoveryListener;

public class MyDiscoveryListener implements IDiscoveryListener {

@Override
public void deviceDiscovered(RemoteXBeeDevice discoveredDevice) {
    Log.d("see",">> Device discovered: %s%n"+discoveredDevice.toString());
}

@Override
public void discoveryError(String error) {
    Log.d("see",">> There was an error discovering devices: " + error);
}

@Override
public void discoveryFinished(String error) {
    if (error == null)
       Log.d("see",">> Discovery process finished successfully.");
    else
        Log.d("see",">> Discovery process finished due to the following error: " + error);

    System.exit(0);
}

}

but it discovers only himself- why? all the other devices are in the same network.
Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions