Xactware Customers Want Mobile • We tried mobile a few Omes… – Apple Newton – Windows Mobile – XP Tablet EdiOon – Blackberry – iOS (naOve objecOve C) • Too much overhead and customer maintenance • Finally a shared iOS and Android version
User’s Mobile Experience • Why do they want a mobile soluOon? • What makes sense? • Don’t try to include everything • Desktop applicaOon without a mouse and keyboard.
Mobile Devices • Keeping up with new devices • FragmentaOon • When to force an upgrade of hardware • Internal tesOng device budget
Why We Chose1. UOlize exisOng, complex codebase 2. Same calculaOons across plaiorms 3. Speed of deployment 4. .NET developer recruitment 5. TransiOon and training of developers 6. RelaOonship with Xamarin
How We Started • Created a new mobile soluOon – Learned later on we needed 2 soluOons • One for each plaiorm Android and iOS – Xamarin.iOS libraries are not compaOble on Android – Decided what assemblies we needed. – Started adding empty projects and then adding in ﬁles to them and compiling – Added needed references and dependent assemblies and classes – Got everything compiling as a ﬁrst step, nothing visual yet.
Project Structure • We created two soluOons – iOS and Android – Custom build commands to replace the AndroidManifest.xml to have to separate package names
Sketch Interface ImplementaMon • Created a test setup environment for our Sketch applicaOon • Implemented Drawing class for sketch • Used mouse click events and connected to touch events and touched the screen – Jumped up and down in excitement because 20 years of code was now running on iOS and android
iOS CompilaMon • Edge Cases: – Assembly size – We ran into a case where we could not compile an assembly because we exceeded the gcc limit – we had to split the assembly.
Memory Management • Windows Desktop applicaOons don’t worry about memory like you need to on Mobile devices. This is a large concern porOng huge code bases to mobile – Events • Must release them. += must be followed with -‐=, this will kill you • NaOve Controls – iOS – UITextView and all naOve controls, you must dispose them explicitly.
2 GC Systems on Android • Use structs instead of classes when your system is allocaOng thousands of objects per second. The GC can’t keep up
GC on iOS • We had to explicitly call collect in a few cases to keep performance up • We had to increase the number of trampolines • Mixed library using naOve objecOve c librarys are really hard to debug, Just don’t do it unless you have to.
Preprocess DirecMves • We had to use liberal amounts of #if !MONO throughout the code base to remove non .net pieces of our desktop applicaOon
Lucene • It overﬂows on purpose – Change the compiler to not care about overﬂows otherwise it will crash randomly in places that do not make any sense. Total garbage call stacks.