cross-platform mobile development in java the e-survey case fernando pereira - capps meeting #11 -...
DESCRIPTION
Context - The RadioLog project Fernando PEREIRA - CAPPS meeting # /10/2015 The RP group has to ensure radiological safety at CERN facilities Frequent radiation surveys are carried throughout the accelerator tunnels Radiation survey teams measure the radiation levels with probes Several measurements are performed every 100 meters weeks of work Optimizations needed Unified solution No “version jungle” Easier maintenance Identical “look-and- feel” for the users/clients Centralized storage Consistent data automatic Backed- up More secure Access is controlled Role based: Admin, Super-user, Users Open/Closed surveys Faster Friendly user interface Survey guides Automatic localization 3TRANSCRIPT
Cross-platform mobile development in JavaTHE E-SURVEY CASE
Fernando PEREIRA - CAPPS meeting #11 - 30/10/2015
Fernando PEREIRA - CAPPS meeting #11 - 30/10/2015 2
• Context• RP radiation surveys• What’s wrong with web based?
• Development process• Java & Codename one• Examples• Deployment process
• Lessons learned• With eSurvey implementation
Outline
3
Context - The RadioLog project
Fernando PEREIRA - CAPPS meeting #11 - 30/10/2015
• The RP group has to ensure radiological safety at CERN facilities
• Frequent radiation surveys are carried throughout the
accelerator tunnels• Radiation survey teams measure the radiation levels with
probes
• Several measurements are performed every 100 meters weeks of work
Optimizations needed
Unified solution• No “version
jungle”• Easier
maintenance• Identical “look-
and-feel” for the users/clients
Centralized storage• Consistent data • automatic
Backed-up
More secure• Access is
controlled• Role based:
Admin, Super-user, Users
• Open/Closed surveys
Faster• Friendly user
interface• Survey guides• Automatic
localization
Fernando PEREIRA - CAPPS meeting #11 - 30/10/2015 4
Data serverApplication server
Database
File system
Application stackWeb Application(interface, logic, data model)Framework (optional)
Back-endFront-end
• eSurvey
• radioLog
Context - The RadioLog project
Fernando PEREIRA - CAPPS meeting #11 - 30/10/2015 5
• eSurvey v1 was born web-based!• Python/Django logic• Jquery mobile
• Pros:• Good looking, • high development productivity• Still programming for the web -> freedom!
• Cons:• Actions execute server-side –> quite some server communication -> less
reactive• Those parts where WLAN is not there? And 3G fails? -> Problematic!• Can’t be used for critical processes!
Context – Web based app? …
Fernando PEREIRA - CAPPS meeting #11 - 30/10/2015 6
• Objectives:• Keep platform independency… • Run on whatever Tablet–style device
• “Hardened” app• Handle connection problems, auto-save, verification,
responsive• Leverage existing in-house knowledge• Avoid exotic frameworks/ languages (Objective C?)
• Java sounds good (Codename one):• Easy to use, comes with Gui Builder, • Fast - calls translated into native code• Portable to iOS, Android, windows, Blackberry…• build-servers • 100 free build credits per month
Development – Native? Cross-Platform?
Fernando PEREIRA - CAPPS meeting #11 - 30/10/2015 7
• Remember: Project is fairly recent:• Documentation is not awesome...• Little / Confusing• Tutorials/Guidelines? Errr
• Community is not that large• But Chen answers a lot in stackoverflow
• Sometimes…• Things don’t seem logic• It will not work well in the real device!
• Best way:• Play with examples• See source code :/
• There’s a Gui Builder!• Be kind to it! And have patience!
Codename1 – Where to start?
Fernando PEREIRA - CAPPS meeting #11 - 30/10/2015 8
Codename1 – moving between forms
GuiBuilder writes to StateMachineBase.java - implements App basic workflow - Includes helpers to find form controlsLittle control over load/initialize/show formsForms referenced by their name Form mainfrm = showForm(“mainForm”)
The way we do: - constant names (no literals!) organized into static classes - Initialize contents in “Before Show” event - Control well the “before show”. It will run every time we show the form! - Save a pointer to the intro form here, so you can intro.showBack();
Fernando PEREIRA - CAPPS meeting #11 - 30/10/2015 9
Codename1 – A fancy list
Imagine a scrollable list of complex lines - text boxes, buttons, etc
Implement with list control, custom renderer… - Probably possible but messy - callbacks must be implemented manually
Solution: - Scrollable container - Dynamically added N Components, designed with Gui Builder
Fernando PEREIRA - CAPPS meeting #11 - 30/10/2015 10
Codename1 – A fancy list running
SimulatorReal device
Fernando PEREIRA - CAPPS meeting #11 - 30/10/2015 11
• With more than 20 “lines”, the list became veeery slow…• Totally redrawing of form every box focus change.
->That’s “normal”, we were told by developers
• Some “unexpected” behaviors :p
Codename1 – Oooops
Fernando PEREIRA - CAPPS meeting #11 - 30/10/2015 12
• Register in codenameone.com• Register in developer.apple.com using
your CERN email• Register dev device and App IDs at CERN
with servicenow• Once ready, download certificates and
provision profile, and set Proj props• NOTE: Apparently Codename1 now has a
wizard to help generating the certificates• Don’t exactly know if it can be used by us, since
the provisioning profile can’t be directly generated by the CERN developer
• Hit Send iOS/… build
• Access the build server page with the iPad and “Install”
Codename1 – Deployment
Fernando PEREIRA - CAPPS meeting #11 - 30/10/2015 13
• Codename one effectively allows writing cross-platform apps in Java.• GUI Builder is nice, allows for very detailed interface styling• Simulator is quite good• Includes network and performance analyzer
• Deployment is sweet once configured!
• It is still young…• GUI builder should feel/be more professional• Interface performance doesn’t feel so “native”.• Stay within short limits when creating forms
• Not all Java API is available. Currently support for java 5.• Expect some bugs. Eventually subscribe professional
support. They look responsive!
Codename1 – Lessons learnt