Message:

Subscribe rss
Blog categories
All | Backendless features
Feature 39: Adding geopoints with related data objects
February 15, 2015 by markpiller

Previously I wrote how to save in Backendless data objects with related geopoint(s). The data-to-geo relations are bidirectional. It means just like a data object may reference a geopoint (or more than one) as a relation, a geopoint may reference a data object or a collection of in its metadata. Consider the example below. The code saves a geopoint which represents the Eiffel Tower. The geopoint references a data object which represents the tower’s main engineer Gustavo Eiffel saved in the Architect table. Notice the “gustavoEiffel” object is a plain Java object (a POJO) which is saved in the Data Service storage in backendless. The relation between the geopoint and the data object is handled through the geopoint’s metadata:

Synchronous API sample (Plain Java only):

Asynchronous API sample (Android and Plain Java):

Asynchronous API sample:

Synchronous API sample:

Asynchronous API sample:

Synchronous API sample:

The Architect class:

Once you run the code and open the Geolocation screen in Backendless, you will see the following:
saved-geo-point

If you click the Architect object link in the geopoint’s metadata column, the console displays the following popup, which makes it very easy to see the related data object:
related-architect

Alternatively, if you navigate to the Data screen and select the Architect table, it will show the saved data object:
architect-object

Enjoy!

Share this post
Tweet about this on TwitterShare on FacebookGoogle+