Not able to read/write from/to beacon storage


#1

I’m using Android SDK and I’m trying to read from or write into beacon storage. I’m able to connect to a beacon using DeviceConnection but when I try to read/write from/to beacon storage, I get error Error INVALID_REGISTER_ID ,register=3040). I’m not sure what does this error mean.

Below is the code snippet I’m using.

`

@Override
public void onConfigurableDevicesFound(List<ConfigurableDevice> configurableDevices) {
Log.d(TAG, "onConfigurableDevicesFound");
    for (ConfigurableDevice configurableDevice : configurableDevices) {
        String deviceId = configurableDevice.deviceId.toHexString();
        if (deviceId.equalsIgnoreCase("<device id of a device I'm trying to connect to>")) {
            mBeaconManager.stopConfigurableDevicesDiscovery();
            mConnectionProvider = new DeviceConnectionProvider(this);
            mConnectionProvider.connectToService(new DeviceConnectionProvider.ConnectionProviderCallback() {
                @Override
                public void onConnectedToService() {
                    Log.d(TAG, "onConnectedToService");
                    final DeviceConnection connection = mConnectionProvider.getConnectionForStorageRead(configurableDevice);
                    connection.connect(new DeviceConnectionCallback() {
                        @Override
                        public void onConnected() {
                            Log.d(TAG, "onConnected");
                            Map<String, String> map = new HashMap<>();
                            map.put("<some key>", "some value");
                            if (connection.isConnected()) {
                                connection.settings.storage.writeStorage(map, new StorageManager.WriteCallback() {
                                    @Override
                                    public void onSuccess() {
                                        Log.d(TAG, "onSuccess");
                                        connection.close();
                                    }

                                    @Override
                                    public void onFailure(DeviceConnectionException exception) {
                                        Log.d(TAG, "onFailure:" + exception.getLocalizedMessage());
                                    }
                                });
                            }
                        }

                        @Override
                        public void onDisconnected() {
                            Log.d(TAG, "onDisconnected");
                        }

                        @Override
                        public void onConnectionFailed(DeviceConnectionException exception) {
                            Log.d(TAG, "onConnectionFailed:" + exception.getLocalizedMessage());
                        }
                    });
                }
            });
        }
    }
}`

#2

It seems that your beacon does not support storage. Not all Estimote beacons have this feature. Can you check your beacon’s firmware and hardware version?


#3

Thank you for the reply. How do I know if my beacon supports storage? My beacon firmware version is 4.9.4 and hardware version is G1.8. According to documentation, beacons having firmware version 4.9.0+ do support storage APIs.


#4

Hi, I am getting the same error what you got. How did you resolve this?


#5

As mentioned previously it usually means that your beacon does not have Flash memory IC for storage. You need to buy a Location Beacon or UWB Beacon: https://estimote.com/products/
To be sure please check if your beacon supports Flash storage:
https://community.estimote.com/hc/en-us/articles/204092986-Technical-specification-of-Estimote-Beacons-and-Stickers


#6

Hi

Thanks for the update. However after I change below line
final DeviceConnection connection = mConnectionProvider.getConnectionForStorageRead(configurableDevice);

to
final DeviceConnection connection = mConnectionProvider.getConnection(configurableDevice);

able to store the data. However I am getting into other issue that I can’t access beacon using android mobile without internet. Do you have any suggestions for this?


#7

You can access beacon for data read without internet connection. You need to use getConnectionForStorageRead and you may leave app ID and app token as empty strings: EstimoteSDK.initialize(applicationContext, “”, “”);
If you want to store data, you need to use mConnectionProvider.getConnection(configurableDevice); and you need internet connection because beacons needs to be authorized with the Cloud.
Similar topic was already covered here: Tried to read 1mb storage with android