This KB is an example of an offline App that synchronize data by services manually implemented. That means it does't use the Automatic Offline Data Synchronization programs.
It emulates a Sales Force Automation app, that has the following characteristics:
- When connected, the user can load all Customers to visit and Produts that can sells ( Master tables).
- With or without internet connection, the user is able to insert Orders (Events), navigate through Product list and execute local actions, for instance, to calculate the distance to clients locations (using GPS), etc.
- When connected, the user can send to the server all the local orders.
- Open GeneXus X Evolution 3
- File\New\Knowledge Base From GXserver. Select server http://open.genexusserver.com/tilo, and chose the KB "SalesForceOffline" (use your gxtechnical credentials in order to connect to GXserver)
- Set your preferred Web generator. Can be Java, .Net or Ruby.
- Check that the POSOfflineOfflineDatabase object has this properties values:
- Data Receive Criteria = Never
- Send Changes =Never
- On Smart Device generator, set "Generate Android" property to "True"
- Rebuild All and Run
- On the Browser execute: Menu / Initialize Server Tables to load sample data.
For this first example, you will notice that user defined web services are being invoked in order to load local master tables from the server. So we need to indicate to the SD app the URL of our backoffice (web app) in order to retrieve the data through these web services. To do that, open the SystemInfo domain and change the enumerated values "ServerHost", "ServerBaseURL" and "ServerPort" with your own values (taken from your web app deployment). If you want, you can leave the default values and use a predefined web service.
After that, select the Dashboard object "POSOffline" and Run it. Notice that the object has the Connectivity Support property with "Offline" value.
Important: It's not possible to execute an Offline App using the KBN.
If you try to run a Dashboard with Connectivity Support = Offline the KBN will crash with the following error: "The application knowledge base navigator (process com.artech.prototyper) has stopped unexpectedly. Please try again.Force Close"
- Once the app is installed on the device/emulator, the first step is to load the master tables from the server. This can be done through the "Load Data" menu option.
- At this point you can start using the application in offline mode.
- Select one of the customer to visit and from "Add Products" , start to add products to the customer's order.
- To complete the sales process for a customer, press the "Checkout" button.
- To see the Orders already inserted, go to "Local Orders" menu option. There you have an option to send that orders pending to send to the server.
- From "Local Order" dashboard option, you can see all pendings and working orders, and by means of the "Send" menu option you can send it to the server, whenever you have internet connection
- The server will return the order status. Also you can check that orders from your Web backoffice application.
Hope you find it useful!