3. GWT Development
for Handheld Devices
A successful story within
a retail store chain
- November 2014 -
4. Project Scope & Requirements
● Remake of all mobile «apps» used by point of
sales:
o Item Inventory, reorder, tracking;
o Competitor Price Survey;
o etc.
● Previous architecture:
o Native “apps” build with C# .NET + Oracle DB Lite;
o Windows CE on Motorola MC3090/MC3190.
● Requirements:
o Providing support to different:
o OS: Windows CE and Window Mobile (Android, etc);
o Device/Vendor models;
o Applications must work without network connectivity.
5. Handheld Devices
Motorola MC3190 Motorola MC55
MEM 256MB Ram
1GB Flash
MEM 256MB Ram
1GB Flash
CPU Marvel PXA320
624MHz
CPU Marvel PXA320
624MHz
RES 320x320px RES 480x640px
OS Windows CE OS Windows Mobile 6.5
Datalogic Skorpio Datalogic Elf
MEM 256MB Ram
512MB Flash
MEM 256MB Ram
256MB Flash
CPU XScale PXA310
624 MHz
CPU XScale PXA310
624 MHz
RES 240x320px RES 480x640px
OS Windows Mobile 6.5 OS Windows Mobile 6.5
7. RhoMobile Suite
● Build native enterprise mobile apps using web
skills: JS, HTML5 and CSS3.
● Includes:
o RhoMobile “mobile application container”:
● Rhodes JS/Ruby API: access to device level
capabilities like camera, geo-location, etc.
● RhoElements JS/Ruby API: access to Motorola
hardware capabilities like bar code scanner, etc.
o RhoStudio (Eclipse based)
o RhoConnect and RhoGallery
● Supports several mobile OSs:
o Android, Apple iOS, Windows Embedded Handheld,
Windows CE and Windows Phone 8.
● Provides a Webkit based browser to Windows
Mobile/CE platforms.
11. Code Optimization
- Deferred Binding -
Motorola MC3190 Motorola MC55
MEM 256MB Ram
1GB Flash
MEM 256MB Ram
1GB Flash
CPU Marvel PXA320
624MHz
CPU Marvel PXA320
624MHz
RES 320x320px RES 480x640px
OS Windows CE OS Windows Mobile 6.5
Datalogic Skorpio Datalogic Elf
MEM 256MB Ram
512MB Flash
MEM 256MB Ram
256MB Flash
CPU XScale PXA310
624 MHz
CPU XScale PXA310
624 MHz
RES 240x320px RES 480x640px
OS Windows Mobile 6.5 OS Windows Mobile 6.5
13. Deferred Binding… (2/2)
1. «device.vendor» property controls barcode and WIFI signals implementations and some
others system properties.
2. «device.display» property controls display/layout resource bundles e css classes.
4 devices 4 permutations
14. Web Applications and... offline
● Requirements:
o Applications must boot in case of network/server
problems («offline»);
o Application data must persist in «offline» mode and
after a reboot.
● Standard HTML5 features have been used:
o Application Cache Manifest;
o Local Storage.
15. Application Cache Manifest
● Not available in GWT«out of the box».
● MGWT library (v.1.1.2) has been used.
● Consists in:
o A further linker at compilation-time.
o A Servlet that returns the right manifest file at run-time.
● Custom permutation provider based on the
property «device.model».
17. Application Cache Manifest
- Run Time -
server
manifest.map
2: read
4
client
mc3100
6
artifacts
4: request
5: response
E4080E6DBA00EBDBFCDE21EB12A3F855.manifest
ApplicationCache.db
18. Local Storage
- Incoming Data Persistence -
HTML5 Local Storage
Errai JSON marshaller
0110101010
19. Local Storage
- Outgoing Data Persistence -
● Implementation of a custom persistent queue
for outgoing data: PersistentQueue<T>.
● Outgoing data is stored in «Errai» json format.
● Data is consumed asynchronously by «generic»
consumer PersistentQueueConsumer<T>.
● Outgoing data is sent to the server in
«Jackson» json format (fast transformation) by
PersistentQueueConsumerRemoteCallback with
a PUT/POST.
● Consumer can be also connected to
NotificationManager.
0110101010
20. PersistentQueueConsumer<T>
● «Consumes» outgoing data when:
o Queue items number is greater than a lower bound;
o User does not interact with the device for specific amount
of time.
● Tries to consume a single item:
o On success:
Removes the item from the queue.
Consumes other items all together (up to an upper
bound).
o On failure:
reschedules itself with a delay that grows exponentially
(up to an upper bound).
21. «App» Architecture
- Performance Considerations (MC3190)-
● 256MB ~132MB really available.
● RhoMobile takes ~20s to start & ~ 23MB of memory 108MB
free.
● Different Build Modes:
o Standalone applications (AppN.cache.js ~2MB):
Useful during the application development.
“Low” memory usage: ~58MB (~44%).
Integration among applications was more tricky (one
application running per time).
Menu startup is slow (~30s, just once).
Application launch is too slow (~40s, many times).
o Monolithic Application (AllApps.cache.js ~3.6MB):
Full application startup is slower (~65s, just once).
But application launch is very fast (~0s, many times).
Higher integration among application.
Higher memory usage: ~83MB (~63%).
App 6
Menu
App 1
App 2
App 3
App 5
App 4
Menu
App 1
App 2
App 6
App 3
App 5
App 4