Search code examples
javaandroiddatabaserealmcodenameone

Codename one and Realm integration


I am working on Calendar-Project in Codename one and I want to store my events in a database so I just want to ask that can I use Realm to store my event data. Can Codename one support Realm framework?, And if it is not, then there is any other option which replaces Realm?


Solution

  • As far as I know nobody has ported Realm to Codename One. You could potentially port it using native interfaces, but before spending time on that, I would probably look at the existing cross-platform database options that Codename One already supports.

    Existing built-in options include Storage, File System, and SQL, which are all discussed in the developer guide.

    I generally try to use Storage if possible as it is very simple and the most portable. If you really need an SQL database, then use the SQL facilities.

    I also developed a data access library to provide an extra layer of encapsulation on top of SQL. It provides some nice features like database versioning/updating, and DAO (data access objects) so that you don't have to use SQL for such routine tasks of loading, searching, and saving objects.

    On the server-side, you can use any REST interface. E.g. you can set a Java web service with a MySQL database, or a PHP-powered webservice using Xataface, or use a BaaS using the Parse CN1lib.

    If you're doing a calendar App, you might also want to explore using Google Docs as your data store as they provide good REST APIs for interacting with calendars.

    Lots of options available to you.