70
Porting business apps to Windows Phone Michele Capra aka @piccoloaiutante

Porting business apps to Windows Phone

Embed Size (px)

DESCRIPTION

This is my personal experience in porting a business application from Android to Windows Phone 8.

Citation preview

Page 1: Porting business apps to Windows Phone

Porting business apps to Windows PhoneMichele Capra aka @piccoloaiutante

Page 2: Porting business apps to Windows Phone

What is this talk about ?

‣ My personal experience on porting a business App from Android to Windows Phone 8.

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 3: Porting business apps to Windows Phone

Agenda‣ The App

‣ Development tools

‣ Mockup

‣ Code and development (UI, component, languages)

‣ Integration with OS

‣ App lifecycle

‣ App publish and store

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 4: Porting business apps to Windows Phone

The MDC clientIntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 5: Porting business apps to Windows Phone

The MDC clientThe case study:

‣ Mobile Data Collection (M.E.A.P.)

‣ create mobile application from a Web interface using a series of widgets

‣ deliver Apps to Android Tablet and Phone, iPad, iPhone, Blackberry, Windows Phone 8, Windows 8 RT/Pro

‣ developed by Gulliver, an italian company.

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 6: Porting business apps to Windows Phone

Mdc architecture

App2

App1

App n

Mdc Client

App1App2Appn

Data sync Activated client

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 7: Porting business apps to Windows Phone

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 8: Porting business apps to Windows Phone

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 9: Porting business apps to Windows Phone

Available control in MDC‣ Close acquisition (checkbox, radio)

‣ Free acquisition (textbox, maps,

nfc, barcode/qrcode)

‣ Free Grid acquisition

‣ Lookup acquisition

‣ Touch screen acquisition

(signature, draw)

‣ Media (picture, video)

‣ Messages (show text)

‣ Control flow (if, loop)

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 10: Porting business apps to Windows Phone

Android client exampleApplications Add new customerSalesman visit app

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 11: Porting business apps to Windows Phone

Android client exampleProposed product Visit outcome Notes

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 12: Porting business apps to Windows Phone

Windows phone client exampleApplications Add new customerSalesman visit app

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 13: Porting business apps to Windows Phone

Windows phone client exampleProposed product Visit outcome Notes

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 14: Porting business apps to Windows Phone

MDC client

‣ Native clients (no Phone Gap)

‣ Proprietary protocol

‣ Occasionally connected

‣ Several different widget (picture, signature, position, textbox..)

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 15: Porting business apps to Windows Phone

First big questionIntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 16: Porting business apps to Windows Phone

Which Windows Phone version to support ?

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 17: Porting business apps to Windows Phone

First big questionTo support Windows Phone 7 or not?

We chose not to support it:

‣ Clear Microsoft intent to dismiss Windows Phone 7

‣ Some of the components we needed were only for Windows Phone 8.

Android support from 2.3

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 18: Porting business apps to Windows Phone

Development toolsIntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 19: Porting business apps to Windows Phone

Visual Studio 2012

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 20: Porting business apps to Windows Phone

Android IDE

‣ AndroidStudio

‣ Intellij Idea

‣ Eclipse

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 21: Porting business apps to Windows Phone

IDE

Both support:

‣ Code completion

‣ Emulator

‣ Debugging

‣ Visual designer

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 22: Porting business apps to Windows Phone

IDE

Jet Brains solution could help you:

‣ Intellij Idea keyboard scheme and shortcut are available for Visual Studio through ReSharper plugin

‣ Code navigation, refactoring shortcuts…

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 23: Porting business apps to Windows Phone

MockupIntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 24: Porting business apps to Windows Phone

Mockup‣ UI + Controls + Navigation - Logic

‣ Didn’t look at Android app code

‣ Just investigate

‣ Trying to figure out how to translate App flow from Android to Modern UI

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 25: Porting business apps to Windows Phone

Mockup

‣ Windows phone app

‣ Navigation between pages

‣ No SketchFlow

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 26: Porting business apps to Windows Phone

MockupAndroid Windows Phone

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 27: Porting business apps to Windows Phone

MockupAndroid Windows Phone

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 28: Porting business apps to Windows Phone

MockupAndroid Windows Phone

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 29: Porting business apps to Windows Phone

MockupAndroid Windows Phone

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 30: Porting business apps to Windows Phone

MockupAndroid Windows Phone

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 31: Porting business apps to Windows Phone

Mockup

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 32: Porting business apps to Windows Phone

ComponentIntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 33: Porting business apps to Windows Phone

Component App capabilities:

‣ Take picture

‣ Read BarCode/QR Code

‣ Read NFC

‣ Get GPS coordinate

‣ Take signature

‣ Use web view

‣ Store data in a database

‣ Multi-language support

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 34: Porting business apps to Windows Phone

Component

‣ Take picture (Intent → Request CameraTask)

‣ Read BarCode/QR Code (ZXing → ZXing.net)

‣ Read NFC (Intent → Microsoft library to do the job)

‣ Get gps coordinate ( LocationManager → GeoLocator)

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 35: Porting business apps to Windows Phone

Component

‣ Take signature (Canvas & Path → InkPresenter)

‣ Use web view (WebView → WebBrowser)

‣ Store data in a database (SQLite → SQLite)

‣ Multilanguage support (Xml file → Multilingual App toolkit)

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 36: Porting business apps to Windows Phone

Component - Database

‣ We had to make a choice between:

‣ LocalDb

‣ SQLite

‣ SQLite won because of the experience with other platform

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 37: Porting business apps to Windows Phone

So let’s start developingIntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 38: Porting business apps to Windows Phone

CodeIntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 39: Porting business apps to Windows Phone

Java vs C#Academic answer for similarities:

‣ Statically strong typed

‣ Class-based, Object-oriented

‣ Semi-interpreted

‣ Garbage collection

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 40: Porting business apps to Windows Phone

Java vs C#‣ convert basic type

‣ change data structure:

‣ Vector<T> → List<T>

‣ HashTable<Integer,Integer> → Dictionary<int,int>

‣ change method name i.e: string.startWith() → string.StartsWith()

‣ StringTokenizer → String.split(string)

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 41: Porting business apps to Windows Phone

Java vs C#

Different pattern:

‣ Android: Model-View-Presenter pattern but View and Presenter highly coupled.

‣ Windows Phone: Model-View-ViewModel pattern, Binding mechanism.

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 42: Porting business apps to Windows Phone

FrameworkCaliburn as framework:

‣ Screen-conductor mechanism

‣ Screen: a stateful unit of work existing within the presentation tier of an application. It’s independent from the application shell.

‣ Conductor: Conductors manage the life cycle state of one or more screens.

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 43: Porting business apps to Windows Phone

Framework

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Conductor

(ViewModel, Page)

Screen

(ViewModel,UserControl)

Page 44: Porting business apps to Windows Phone

FrameworkCaliburn as framework:

‣ EventAggregator: messaging between classes

‣ PhoneBootstrapper: custom bootstrapper designed to setup phone applications.

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 45: Porting business apps to Windows Phone

UIIntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 46: Porting business apps to Windows Phone

XML vs XAMLSimilarity:

‣ LinearLayout → StackPanel

‣ TextView, TextEdit → TextBlock,TextBox

‣ ScrollView → ScrollViewer

‣ Radio Group, RadioButton → RadioButton

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 47: Porting business apps to Windows Phone

Values vs Xaml style

Android Values:

<color name=“white”>#FFFFFFFF</color>

!

Windows Phone Xaml control style:

<Color x:Key="white">#FFFFFFFF</Color>

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 48: Porting business apps to Windows Phone

Integration with OSIntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 49: Porting business apps to Windows Phone

Integration with OS

‣ Make a phone call

‣ Send an email

‣ Open Map

‣ Navigate to a place

‣ Open link in browser

‣ Open pdf/office file

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 50: Porting business apps to Windows Phone

Integration with OSIn Android you do this by intent and activity.

!

Intent callIntent = new Intent(Intent.ACTION_CALL);

callIntent.setData(Uri.parse("tel:0377778888"));

startActivity(callIntent);

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 51: Porting business apps to Windows Phone

Integration with OSIn Windows Phone you use Tasks.

!

PhoneCallTask phoneCallTask = new PhoneCallTask();

phoneCallTask.PhoneNumber = "2065550123";

phoneCallTask.Show();

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 52: Porting business apps to Windows Phone

Integration with OSSending email in Android.

!

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{to});

startActivity(emailIntent);

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 53: Porting business apps to Windows Phone

Integration with OSSending email in Windows Phone.

!

EmailComposeTask emailComposeTask = new EmailComposeTask();

emailComposeTask.To = “[email protected]”;

emailComposeTask.Show();

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 54: Porting business apps to Windows Phone

App lifecycleIntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 55: Porting business apps to Windows Phone

Android activity lifecycle

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 56: Porting business apps to Windows Phone

Windows Phone lifecycle

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 57: Porting business apps to Windows Phone

Be careful

From Microsoft docs:

“It is possible, however, for an app to be tombstoned after the user navigates away. In this case, the app is not preserved in memory, but some information about the app is stored – most importantly for this topic, the State dictionary of the PhoneApplicationPage object is stored”

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 58: Porting business apps to Windows Phone

Be careful

‣ Serialised and deserialise the app state that is not a part of the page

‣ Rebind all the dependencies

‣ Update UI value (i.e: something typed from user before tombstoning)

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 59: Porting business apps to Windows Phone

Be careful

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 60: Porting business apps to Windows Phone

StoreIntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 61: Porting business apps to Windows Phone

App package

‣ Xap file which includes everything needed from the app.

‣ It’s almost like an apk file.

‣ You cannot install xap out of store.

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 62: Porting business apps to Windows Phone

Google Play store

‣ Generate key pair and certificate and keystone

‣ Sign your app and verify signed app

‣ Upload and publish to Play store

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 63: Porting business apps to Windows Phone

Windows Phone store

Validation

‣ Package verification

!

Certification

‣ Sign and encryption

!

Publish

‣ Ready to be published

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 64: Porting business apps to Windows Phone

Windows Store Test Kit

The Windows Phone Windows Phone Store Test Kit (formerly named Marketplace Test Kit) provides a suite of automated and manual tests to help prepare your apps to be accepted in the Windows Phone Store the first time you submit them.

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 65: Porting business apps to Windows Phone

Testing for tombstoning

‣ Before upload your xap to store simulate tombstoning and test your app manually.

‣ Tombstoning could be forced manually by Visual Studio.

IntroductionThe AppDevelopment toolsMockupCodeIntegration with OSApp lifecycleApp publish & store

Page 66: Porting business apps to Windows Phone

Recap‣ The App

‣ Development tools

‣ Mockup

‣ Code and development (UI, Component, languages)

‣ Integration with OS

‣ App Lifecycle

‣ App publish and store

Page 67: Porting business apps to Windows Phone

My personal experience

‣ Java is not far from C#

‣ Build a mockup in order to explore new platform

‣ Keep an eye on app lifecycle

Page 68: Porting business apps to Windows Phone

My personal experience

‣ No object mapping SQLite-net is too slow

‣ I doubt that i would reuse a framework

‣ I would rather use a toolkit

Page 69: Porting business apps to Windows Phone

My personal experience

‣ MVP gave to Android app the possibility to have full access and control of the UI

‣ MVVM gave to Windows Phone 8 a partial access to the UI

‣ ViewFirst approach was a part of the problem

Page 70: Porting business apps to Windows Phone

grazie! @piccoloaiutante