Official Content

As explained in the Connectivity Support property's documentation, this property has 3 possible values: Online, Offline and Inherit.

By changing this property's value in a per-object basis, it is possible to decide whether some sections of the application are going to work with the local Database (Offline) or by calling REST services to get the panel's data (Online).

How it works

As an example, a simple Event application containing information about Sessions and Speakers and that displays a list of Tweets related to the Event will be used.

This simple Event application has the following 3 Transaction objects with their corresponding Work With objects:

ConnectivitySupport Example 01 - v17 and 18

Now that the app is designed, let's turn it into an Offline application. To do that, all you have to do is set the Connectivity Support property of the main Menu object to "Offline".

Note: Remember that for all non-Main objects, the Connectivity Support property is set to inherit by default.

ConnectivitySupport Example 02 IDE - v17 and 18

After building the Menu object, the Offline Database object is created with the Speakers, Session and Tweets tables (as explained in the Offline Database object documentation), as those are the tables that are accessed by the offline objects.

ConnectivitySupport Example 02 - v17 and 18

After this, the Event application will have all the tables stored locally and all the Database access will be performed on the local Database.

But what if instead of storing the Tweets locally, you make that WW to work Online? This is for a very simple reason: Tweets will vary much more often than the rest of the application's information, and you may want to have them available as soon as they are published. It's better than waiting for a synchronization to get the latest tweets or synchronizing more often just to get them.

Having this configuration is as simple as setting the Connectivity Support property of the Tweets' Work With object to "Online".

Then the tables that are going to be in the OfflineDatabase are only "Speakers" and "Sessions" as shown in the image below:

ConnectivitySupport Example 03 - v17 and 18

Using the Connectivity Support property over Procedures or Data Providers

As explained in the Connectivity Support property documentation, this property is also available for Procedures and Data Providers. This makes it much easier for the developer to call Online Procedures or Data Providers from Offline objects.

An intricate way of calling an online Procedure, which is exposed as a REST service, from an offline panel is by using the HttpClient data type. On the other hand, a much simpler way of doing the same is to set the Connectivity Support property of the Procedure into "Online". This forces the offline application to always call this Procedure via REST services. The device executes the same process as if the HttpClient data type is used instead, however this property gives a cleaner and simpler solution.

Following the scenario mentioned in this document, suppose you want to call a Procedure, which is exposed as a REST service, and which also returns all new Tweets that mention your event.
As mentioned in the Offline Native Mobile applications architecture, if an application is set into offline architecture, by default, it calls all Procedures locally. To avoid this behavior when calling our Tweets Procedure, you just need to change the Connectivity Support property of that Procedure into "Online".

About Connectivity Support's "Inherit" value

Inherit value adds flexibility to your solution, since it makes it possible that an object "A" works either Online or Offline, depending on the Connectivity Support property of the caller object.

For instance, if there are three mobile objects: objectA, objectB, and objectC that have the following properties configuration:

  • Object A connectivity Support : Inherit
  • Object B connectivity Support : Online
  • Object C connectivity Support : Offline

If B calls A, then A will work as an Online object (Works with data of the web server)
If C calls A, then A will work as an Offline object (Works with data of the offline Database)

Note: This applies only to the case that the connectivity Support of the Main object is Offline. If that is online, the whole architecture changes and, in the sample above, B cannot call C. So you cannot call an offline object in an online application.

See Also

Connectivity Support property
Offline Database object
Offline Database Object Table selection

Last update: November 2023 | © GeneXus. All rights reserved. GeneXus Powered by Globant