Thales' cellular IoT products business is now part of Telit Cinterion, find out more.

You are here

Telit Cinterion IoT Developer Community

Concept Board: RecordStore demo MIDlet

Tutorial, May 8, 2014 - 1:36pm, 8482 views

General overview

EHS6 offers record store feature, which provides the possibility to save user data to non-volatile module's memory. A record store consists of a collection of records which will remain persistent across multiple invocations of the MIDlet. Record stores are created in platform-dependent locations, which are not exposed to the MIDlets. Record stores can also be shared between MIDlets. Every record in record store has unique numerical identifier.

Please see picture below for clear look.

RecordStore Java API

Provided Record Store Java API consists of following classes:

  • RecordStore class - used for accessing the store
  • RecordEnumeration interface - used for listing stored records
  • RecordComparator interface - used for sorting enumerated records
  • RecordFilter interface - used for filtering enumerated records
  • RecordListener interface - used for monitoring record store events

Opening RecordStore

First step in Record Store usage is opening the store:

RecordStore rs = RecordStore.openRecordStore("Diary", true);

Preparing record data

To add new record you must prepare byte array of data first. Strings can be easily converted to byte array using getBytes() method. Unfortunately there is no build-in feature to convert numerical types directly to byte array. You could use following conversion chain: number -> string -> bytes or implement own byte-by-byte conversion.

Adding records

If the data is already prepared and temporarily passed to byteArray, you can use following pattern to store it:

int recordId = rs.addRecord(byteArray, 0, byteArray.length);

Record ID is returned value.

Records enumeration

Follow below code pattern to enumerate records.

RecordEnumeration re = enumerateRecords(filter, comparator, keepUpdated);

// iterate over selected records

byte[] record;


    record = re.nextRecord();

    // process record...


nextRecord method returns byte array for further processing.

Make sure that filter and comparator objects implement RecordFilter and RecordComparator interfaces. Pass null if no filter or comparator is needed.

Deleting records

To delete a record simply call:


Example diary application concept

As an example we will implement an application which will fulfill following requirements:

  • Application listens for buttons events: BTN-A pressed, BTN-A released, BTN-B pressed, BTN-B released.
  • All events occurances are saved to record store as separate records with timestamp and event type (pressed/released).
  • MIDlet is terminated by releasing BTN-B.
  • All records are printed on stdout on application start and shutdown.

Please find eclipse project in tutorial's attachment. Follow in-file documentation for details.


Thanks to Record Store you can save non-volatile user data like log information, application state or configuration settings with minimal developing effort without worrying about platform specific issues. Please remember that consecutive writing operations may damage FFS.

This tutorial shows only basic usage of record store. Please check Java API reference for details.

Download File (zip | 43.67 KB)
This is very useful. I have seen many people using all kind of AT command + Java combinations. The record store system works better and is easy to implement and understand.

Antero Markkula
Communication and Mechatronics

Enkom Active Oy –
Upseerinkatu 3 A, 02600 Espoo, Finland
Mobile: +358 400 411368
Office: +358 10 204 0000
Fax: +358 10 204 0010


I am unable to download this example while logged in, it says "Access Denied". Can someone assist?



He is right...I tried to download this example myself. I am logged in and clicking on the link results in page showing me "Access Denied". Is there a reason logged in users cannot download this example?


Should work now.

Thank you. Yes it works now. Great, thanks very much!


Jędrzej Gemalto Moderator's picture
Jędrzej Gemalto Moderator