LOCATION BEACON - Fragmented reading


#1

Hi!
In the iOS source codes provided by Estimote, I noticed that to recover the data stored in the memory of the beacon we do:

NSString * storage = value.allValues [0];

So, I was wondering if the fact that there is an array is because we can “fragment” our data in this array and we can do:

NSString * name = value.allValues [0];
NSString * image = value.allValues [1]; // Base64
NSString * description = value.allValues [2];
...

This will allow me to optimize my reading time.
Thank you!


/!\ /!\ /!\ /!\ /!\ EDIT /!\ /!\ /!\ /!\ /!\
It’s good I got the answer. In fact, I saved my datas badly.
So, I have another question: Is it possible to read a few keys instead of all (example: the keys of index 0 and index 2) because the key of index 1 is for an image (base64), and this image is very long to read so I would first read all the others, display them and then read the image and display it afterwards.


#2

You can create an a dictionary that points to an array—you’re right, that’s gonna be more space-efficient:

// save
NSDictionary *data = @{"data": @[name, image, description]};
[storageManager saveStorageDictionary:data //...

// load
[storageManager readStorageDictionaryWithCompletion:/* ... */ {
    NSString *name = value[@"data"][0];
    NSString *image = value[@"data"][1];
    NSString *description = value[@"data"][2];
    //...
}];

Is it possible to read a few keys instead of all (example: the keys of index 0 and index 2) because the key of index 1 is for an image (base64), and this image is very long to read so I would first read all the others, display them and then read the image and display it afterwards.

Currently, there’s not. Interestingly enough, on the firmware level, that’d be possible to do, but our SDKs at this time always read all of the data. We would also have to use something else than JSON for serialization.


#3

Ok because when I read all of the JSON content in my beacon, It lasts 2 minutes 12 seconds (for iOS) and 6 minutes 30 seconds (for Android) and I don’t see how resolve it.