Sei sulla pagina 1di 33

Offline mobile applications

with GeneXus
Offline Applications

Web server
Offline Applications

Web server

Connected (Online)
Offline Applications

Web server

Compiled App
Metadata
Web App

Rest Web DP
Services BC’s

Connected (Online)
Behavior

Events WWDevices<Session>_Session_List()

Start

Refresh

WWDevices<Session>_Session_List_Grid())

Connected (Online)
Load n times

Offline Applications

Web server

Partially connected
Offline Applications

Web server

Disconnected (Offline)
Offline Applications

Web server

Disconnected (Offline)
Offline Applications

Web server

Compiled App
Metadata
Web App

Rest Web DP DP
Services BC’s Syncronization BC’s

Disconnected (Offline)
Behavior

WWDevices<Session>_Session_List()
Events …
Start

Refresh

Java (Android)

WWDevices<Session>_Session_List_Grid())

Disconnected (Offline) Load

Offline Applications

Web server

Compiled App
Metadata
Web App

Rest Web DP
Services BC’s
Offline Applications

Data Syncronization Init sync

Web server
Rest services

Rest
Services
Rest
Services
Send

Receive
Offline Applications: SEND

Web server

Web App

Rest Web
Logic to get
Services Send the Events
Pending and
Send it!
Logic to process Pending Events OfflineDatabase: Send Changes property
(execute BCs)

Syncronization.Send()
Offline Applications: SEND

Web server

Web App

Rest Web
Services
GXPendingEvents Table
BCName BC Json Operation Status
Logic to process Pending Events: SDT (data) (Ins,Upd,Dlt) (pending, etc)
GXOfflineEventReplicator
Offline Applications: RECEIVE

Web server Syncronization.Receive()

Web App
Logic to Init the
Rest Web Receive
Services Receive
Logic to get the data OfflineDatabase: Data Receive Criteria property
needed by the device

Granularity By Row
By Table
Offline Applications: RECEIVE

Web server Syncronization.Receive()


Hash table A
Hash table B

Web App
Logic for the
Rest Web
Services Receive Receive:
- Send previous
hashes
- Receive data
Logic to get the data
Granularity By Table (and new
needed by the device:
hashes)
(modified tables)
- Process the
data
Offline Applications: RECEIVE

Web server Syncronization.Receive()


Hash table A
Hash table B

Web App
Logic for the
Rest Web Receive:
Services Receive - Send previous
== table hashes
- Receive new
Logic to get the data table hashes and
needed by the device: lists of modified
(modified tables and Granularity By Row table records
modified records) - Process the lists
Tables to store record hashes of each table
Data Synchronization

Synchronization Conflicts
CountryId CountryName CountryId CountryName

1 Uruguay 1 Argentina
2 Brasil 2 Paraguay

SpeakerId SpeakerName CountryId SpeakerId SpeakerName CountryId


1 Alejandro Cimas 2 1 Armando Cardozo 1
2 Lucía Guedes 1 2 Fabian Bonilla 2
Data Synchronization

Synchronization Conflicts
CountryId CountryName CountryId CountryName

1 Uruguay 1 Argentina
2 Brasil 2 Paraguay

SpeakerId SpeakerName CountryId SpeakerId SpeakerName CountryId


1 Alejandro Cimas 2 1 Armando Cardozo 1
2 Lucía Guedes 1 2 Fabian Bonilla 2

!
Data Synchronization

Synchronization Conflicts
CountryId CountryName
CountryId CountryName 1 Argentina
1 Argentina 2 Paraguay
2 Paraguay
3 Uruguay

4 Brasil

SpeakerId SpeakerName CountryId


SpeakerId SpeakerName CountryId 1 Armando Cardozo 1

1 Armando Cardozo 1 2 Fabian Bonilla 2

2 Fabian Bonilla 2 3 Alejandro Cimas 4

4 Lucía Guedes 3
Data Synchronization

Using GUID data type to avoid conflicts

String of 16 characters with the following format:


“XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX”

i.e.: "2ac61739-b024-438e-a6e5-e507d8be4667"
Data Synchronization

Synchronization API

Manual Synchronization Only


Offline Applications

How to create an Offline app in GeneXus ?

MAIN OBJECT
Offline Applications

MAIN OBJECT: Dashboard


Offline Applications

- Offline

- Inherit
Main
- Online

NO local tables
Offline Database Object

Offline Database Object

Main object

• DB Structure

• DB Creation programs

• Send & Receive configuration

• Start Event and Conditions (filters) for Receive


Offline Database Object

Events
Start Event
(only in Receive)
Offline Database Object

Conditions
(Only in Receive)
Offline Database Object

Properties

Receive

Send
Offline Applications

Offline Apps + GAM

The credentials remain on the server

Login only Online


• Authenticated user is still authenticated when the app goes Offline

Smart Devicies: Only Authentication


Offline
Basic demo
Offline Applications 32

More info:

http://wiki.genexus.com/commwiki/servlet/wiki?22228
VIdeos training.genexus.com
Documentation wiki.genexus.com
Certifications training.genexus.com/certifications

Potrebbero piacerti anche