Post on 28-May-2015
www.softserve.ua
Ecosystem AppsINNOVATIVE CROSS-PLATFORM SOLUTIONS
Sergey SeletskyAbiliton™ Senior Software Engineer
www.softserve.ua
Agenda1. Why?2. What is an ecosystem?3. Problems?4. WinRT with HTML5 for other...5. Cross-platform frameworks
• Xamarin• Titanium• Portable apps• AppMobi
6. Specific integrated API7. Apps integration8. Apps Stores9. Ecosystem architecture10. Conclusions
www.softserve.ua
What is an ecosystem?
www.softserve.ua
www.softserve.ua
Enterprise App Ecosystem
2. Signing Tools
3. App Catalog
1. Registration
1. Develop App
2. Package and sign
1. Device Enrollment
2. Get apps
4. Create Token
3. Cert and Enterprise ID
Registration1. Enterprise registers with App
Hub2. Enterprise downloads app tools3. Microsoft notifies CA of
pending enterprise registration4. Vets enterprise5. CA checks that vetting is
complete, and generates a certificate for enterprise
IT organizationApp Hub Windows Phone
www.softserve.ua
Why ?
www.softserve.ua
Smartphone Market SharePlatforms
Google Apple Microsoft RIM
www.softserve.ua
Native Wrappers• Phonegap • Titanium• appMobi• Create native apps using HTML5• Provide API’s (Hooks to get out of the
sandbox)• Work across platforms (mostly)• Can be submitted to app stores
www.softserve.ua
Cross-Platform Devices
• Phones– iOS – iPhone, Touch– Android– Blackberry– Windows Phone 7
• Tablets– iPad– Android
www.softserve.ua
Mobile Capabilities That Influence Apps• GeoLocation• PIM Contacts• Camera• Barcode• Date/Time Picker• Native Menus• Tab Bar• Navigation Bar• Signature Capture
• Bluetooth• Calendar• Push• Screen Rotation• Native Maps• Alert• Audio File Playback• Ringtones• NFC
www.softserve.ua
Problems?
www.softserve.ua
Cross-platform frameworks
1.Xamarin2.Titanium3.Portable
apps4.AppMobi5.PhoneGap
www.softserve.ua
Xamarin
www.softserve.ua
Asynchronous code before
MyApi.OnSomeMethod += () => {InvokeOnMainThread( (result) =>
{textView.Text = result;
});}
MyApi.SomeMethodAsync();
www.softserve.ua
async/await
textView.Text = await MyApi.GetUrlAsync(
“http://softserveinc.com”);
www.softserve.ua
С# vs Objective-C
Objective-C:
// …[button addTarget:self
action:@selector(touchHandler:) forControlEvents:UIControlEventTouchUpInside];// …
-(void) touchHandler:(id)sender {textView.text = @"some text";
}
www.softserve.ua
С# vs Objective-C
C#:
btn.TouchUpInside += (s, e) => {textView.Text = "Clicked!";
} ;
www.softserve.ua
C# vs Java
Java:
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { textView.setText(“Clicked”); }
});
www.softserve.ua
C# vs Java
C#:
button.Click += (s, e) {textView.Text = “Clicked!”;
} ;
www.softserve.ua
C# vs {0}
• Simply• Cleaner• Develops very quickly• From Java sand pours• [[[[After Objective-C] world : square]
as: very] and all: in the colon];
www.softserve.ua
What is Monotouch
• Mono framework with AOT compilation for ARM processors and Bindings to Native API
• Code is written in C #• UI is native tongue, through C #
wrapper• Development environment Visual
Studio
www.softserve.ua
Compilation process
• Compile your code, libraries, BCL, wrappers over native methods in IL
• You can use any language IL • Converted into machine code using
AOT compilation• Added to app code with Mono
Runtime and everything else
www.softserve.ua
AOT vs JIT
• Usually in. Net and Mono native code generated at run - Just In Time compilation
• In iOS you can not compile code on JIT, only static linking
• But we already know the architecture (ARM) so you can compile the code in advance - Ahead Of Time compilation
www.softserve.ua
Restrictions AOT
• No Emit, but remains Reflection• Some specific designs will not work,
because compiled on JIT• Generic Virtual Methods
– P/Invokes in Generic Types– Some LINQ expressions
www.softserve.ua
Linking
• At time of compilation of IL BCL undertakes only code that is actually used
• Similarly, you can cut out unused code in their libraries
• Need to reduce the size of app
www.softserve.ua
C# API
• Subscribe to Events• Setting Properties• Familiar names
var btn = new UIButton(new RectangleF(0, 0, 200, 80));btn.Enabled = true;btn.SetTitleColor(UIColor.FromRGB(255, 255, 0), UIControlState.Selected);btn.TouchUpInside += delegate {
// your code} ;window.Add(btn);
www.softserve.ua
Wrappers over native methods
Monotouch: • It all comes down to P/Invoke method
objc_msgSend with the appropriate parameters
Mono for Android: • Used JNI (Java Native Interface)
www.softserve.ua
Wrappers over native methods
public virtual bool Enabled{
[Export("isEnabled")]get{
// …return Messaging.bool_objc_msgSend(base.Handle,
UIControl.selIsEnabled);}[Export("setEnabled:")]set{
// …Messaging.void_objc_msgSend_bool(base.Handle,
UIControl.selSetEnabled_, value);}
}
www.softserve.ua
App Structure
• Virtually same in native app• AppDelegate, UIWindows,
ViewControllers• To describe UI also uses nib files
www.softserve.ua
Development environment – Visual Studio
www.softserve.ua
Cross-platform
• Sharing in 30-60 percent of the code• Combining basic mobile functionality• There are various MVVM frameworks
Xamarin
Shared Specific
Titanium
Shared Specific
PhomeGap
Shared Specific
www.softserve.ua
Windows Apps
www.softserve.ua
Use of opportunities of Windows OS
Win32 APIVista BridgeWindows Bridge.NET Framework
– Windows Presentation Foundation– Windows Communication Foundation– Windows Workflow Foundation
www.softserve.ua
Windows 8 platformMetro style Apps
HTML
JavaScript
C++C#VB
Desktop Apps
Win32
.NET / SL
Internet
Explorer
Communication
& Data
Application Model
Devices & Printing
WinRT APIs
Graphics & Media
Syste
m S
erv
ices
JavaScript(Chakra)
CC++
C#VB
XAML HTML / CSSVie
wM
od
el
Con
troll
er
Windows Core OS Services
Core
www.softserve.ua
Installation Store Apps
Store backend
Package Manager
install Execution Engine
Extension Handler
stage Single instance store
register Registration Information
Store
Manifest.xml
BlockMap
Signature
Zip Central Directory
Files / Assets
package
www.softserve.ua
Transitions between states
RunningApp
Suspended
App
suspendingTerminate
dApp
Low Resources
Code gets to runNo code
runs App not running
resuming
App are given several seconds to
sleep
App is not notified
App is notified with continued
User Launches App
Splash screen
www.softserve.ua
Process isolation
OS
User data Devices Communications Handlers Tiles Cryptography … …
Bro
kers
Process1
Local contextWeb
contextAppData
Local Temp Roaming
Contracts
Process2
Local contextWeb
contextAppData
Local Temp Roaming
Dire
ct AP
Is
www.softserve.ua
Language projection
Windows Metadata
C++ AppPro
jectio
n
CLR
C#/VB AppPro
jectio
n
HTML AppChakra
Pro
jectio
nObject
IInspectable
IUnknown
www.softserve.ua
Collections
Array
IInspectable
IUnknownIVector<T>
IVectorView<T>
IObservableVector<T>
Associative Collection
IInspectable
IUnknownIMap<T>
IMapView<T>
IObservableMap<T>
C++ App
STL-style Projection
CL
R
C#/VB App
IEnumerable(T) style
Projection
HTML App
Ch
ak
ra
JavaScriptProjection
www.softserve.ua
Asynchrony in Windows 8
• All that is more than 50 milliseconds – asynchronously
• Windows Runtime: IAsyncOperation<T>
• JavaScript: Promises• C++: Parallel Patterns Library• VB/C#: async /await
www.softserve.ua
ThreadingMain UI thread
Task factory
App Code App Code App Code
Windows UI
Object
Windows
Object
Windows
Object
www.softserve.ua
Architecture WinRTMetro App Language
Support(CLR, WinJS, CRT)
Language projection
Windows Metadata & Namespace
Web Host (HTML, CSS, JavaScript)
Windows Core
Runtime Broker Windows Runtime Core
UI Pickers Controls Media
XAML Storage Network …
DirectX
Win32
www.softserve.ua
Runtime appYour App
Brokered API calls
Direct API calls
Broker
Core
OS
AppXManifest
App Container + Signed & Validated code
Process.exe
WinRT APIs
www.softserve.ua
RuntimeBroker.exe
Brokered Objects
Windows Runtime Object
IInspectable
IUnknown
App
Pro
jectio
n
Pro
xy
www.softserve.ua
Windows Runtime APIs
Fundamentals
Application Services Threading/Timers Memory
Management Authentication Cryptography Globalization
Devices
Geolocation Portable Sensors NFC
User Interface
SVG Tiles Input Accessibility Printing
HTML5/CSS XAML DirectX Controls Data Binding
Communications & Data
Memory Management XML Networking SMS
Notifications Streams
Contracts Local & Cloud Storage Web
Media
Playback Capture PlayTo Visual Effects
www.softserve.ua
Sensors
Agitation Turn Overturning
In dark Indoors Outdoors
Accelerometer
Gyroscope
Compass
Slope
Light
Orientation
www.softserve.ua
Apps integration
www.softserve.ua
Areas of integration
Together
Contracts :• Search• Share
With cloud
Synchronization app settings
Live SDK
On Windows OS
Live tilesNotificationsContractsSettingsPrint…
www.softserve.ua
Pop-up notificationsToast Notifications
Show messages from apps and services outside the UI apps
Attract attention
Is disconnected
Allow the user to go directly to the section of the app
Initiated locally or from cloud
www.softserve.ua
Windows Push Notification ServiceServes pop-up notifications and update live
tiles external services
Tile updated and notifications are working even when not running app
Takes control of communications devices
Scaled without you
Free
Windows 8 Cloud Service
Windows Push
Notification Service
Metro Style App
Notification
Client Platform
2
3
1 3
1. Request for URL notification channel
2. Service registration
3. Notifications
www.softserve.ua
Contracts - part of a large family
• App to App Picking contract• Contact Picker• File activation• Play To contract• Print task settings• Protocol activation• Search contract• Settings contract• Share contract
www.softserve.ua
How does this workTarget appsShare Broker
User selected“Share”
Activated
Registration DataTransfer
Manager
Source app
Filter apps or links
User has selected a target
ProcessingDataPackage
Completion Report
Asynchronous processing
Activation DataPackage
App start-goal
DataPackage in source app
www.softserve.ua
Windows Store
www.softserve.ua
Unprecedented coverage
100+ languages
Shop and Apps
200+countries
Purchase
70+ countries including 40 largest by GDP
Local prices
www.softserve.ua
Income distribution
Starts with 70%new applications
Switches to 80%once you do $25,000
www.softserve.ua
Best economy
To generate $ 1 million profit
Price: $4.99
~250,000 sales
0.05% users Windows from
500+ million Windows 7
www.softserve.ua
Google Play
www.softserve.ua
Cloud Services
www.softserve.ua
www.softserve.ua
Unified set of messaging capabilities Consistent management and observation capabilities
Service Bus RelayRich options for interconnecting apps across network boundaries
Service Bus Brokered MessagingQueuing, publish/subscribe
Easily build hybrid appsAvailable as PaaS & on-premise server
Azure Service Bus
www.softserve.ua
Conclusions
www.softserve.ua
Thank you!