Using DeviceInformation class in Android


#1

I’m a beginner in Java and I’d like to know how to call this DeviceInformation function properly through a brief example so as to be able to query its member functions (getName, getIdentifier…).


#2

DeviceInformation is not actually generated by the LibMuse 5.13 library, however all of the same information is available through the Muse object.

Below, I’ve modified the museListChanged function from the Android example application to print out the name, mac address, RSSI and last discovered time of each Muse. Note however that on Android the RSSI value will always be 0.

public void museListChanged() {
    final List<Muse> list = manager.getMuses();
    for (Muse m : list) {
        Log.i("TestDeviceInformation", "Muse: name = " + m.getName());
        Log.i("TestDeviceInformation", "Muse: identifier = " + m.getMacAddress());
        Log.i("TestDeviceInformation", "Muse: rssi = " + m.getRssi());
        Log.i("TestDeviceInformation", "Muse: last discovered time = " + m.getLastDiscoveredTime());
    }
}