630 likes | 814 Vues
Ecosystem Apps. INNOVATIVE CROSS-PLATFORM SOLUTIONS. Sergey Seletsky Abiliton ™ Senior Software Engineer. Agenda. Why ? What is an ecosystem? Problems? WinRT with HTML5 for other... Cross-platform frameworks Xamarin Titanium Portable apps A ppMobi Specific integrated API
E N D
Ecosystem Apps INNOVATIVE CROSS-PLATFORM SOLUTIONS Sergey Seletsky Abiliton™ Senior Software Engineer
Agenda • Why? • What is an ecosystem? • Problems? • WinRT with HTML5 for other... • Cross-platform frameworks • Xamarin • Titanium • Portable apps • AppMobi • Specific integrated API • Apps integration • Apps Stores • Ecosystem architecture • Conclusions
Enterprise App Ecosystem App Hub IT organization Windows Phone 1. Registration 1. Device Enrollment 2. Signing Tools 2. Get apps 3. Cert and Enterprise ID 1. Develop App 2. Package and sign • Registration • Enterprise registers with App Hub • Enterprise downloads app tools • Microsoft notifies CA of pending enterprise registration • Vets enterprise • CA checks that vetting is complete, and generates a certificate for enterprise 3. App Catalog 4. Create Token
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
Cross-Platform Devices • Phones • iOS – iPhone, Touch • Android • Blackberry • Windows Phone 7 • Tablets • iPad • Android
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
Cross-platform frameworks • Xamarin • Titanium • Portable apps • AppMobi • PhoneGap
Asynchronous code before MyApi.OnSomeMethod += () => { InvokeOnMainThread( (result) => { textView.Text = result; }); } MyApi.SomeMethodAsync();
async/await textView.Text = awaitMyApi.GetUrlAsync( “http://softserveinc.com”);
С# vsObjective-C Objective-C: // … [button addTarget:self action:@selector(touchHandler:) forControlEvents:UIControlEventTouchUpInside]; // … -(void) touchHandler:(id)sender { textView.text = @"some text"; }
С# vsObjective-C C#: btn.TouchUpInside += (s, e) => { textView.Text = "Clicked!"; } ;
C# vs Java Java: button.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { textView.setText(“Clicked”); } } );
C# vs Java C#: button.Click += (s, e) { textView.Text = “Clicked!”; } ;
C# vs {0} • Simply • Cleaner • Develops very quickly • From Java sand pours • [[[[AfterObjective-C] world :square]as:very]and all: in the colon];
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
Compilationprocess • Compile your code, libraries, BCL, wrappers over native methods in IL • Youcan use any language IL • Convertedinto machine code using AOT compilation • Added to app code with Mono Runtime and everything else
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
RestrictionsAOT • 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
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
C#API • Subscribe to Events • Setting Properties • Familiar names varbtn = newUIButton(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);
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)
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); } }
AppStructure • Virtually same in native app • AppDelegate, UIWindows, ViewControllers • To describe UI also uses nib files
Cross-platform • Sharing in 30-60 percent of the code • Combining basic mobile functionality • There are various MVVM frameworks
Use of opportunities of Windows OS Win32 API Vista Bridge Windows Bridge .NET Framework • Windows Presentation Foundation • Windows Communication Foundation • Windows Workflow Foundation
Windows 8 platform Desktop Apps Metro style Apps HTML JavaScript HTML / CSS XAML View JavaScript (Chakra) C C++ C# VB Model Controller C# VB C++ WinRT APIs Devices & Printing Communication & Data Graphics & Media System Services .NET / SL Internet Explorer Win32 Application Model Windows Core OS Services Core
Installation Store Apps Store backend Files / Assets Single instance store Manifest.xml Package Manager stage BlockMap Store install package Execution Engine Signature Registration Information Zip Central Directory register Extension Handler
Transitions between states App are given several seconds to sleep App is not notified suspending Running App Suspended App Terminated App User Launches App Low Resources resuming App is notified with continued Splash screen Code gets to run No code runs App not running
Process isolation Process2 Process1 Local context Local context Web context Web context AppData AppData Contracts Local Local Temp Temp Roaming Roaming Direct APIs Brokers OS User data Devices Communications Handlers Tiles Cryptography … …
Languageprojection IInspectable Object C++ App Projection IUnknown C#/VB App CLR Projection HTML App Chakra Projection Windows Metadata
Collections IInspectable C++ App STL-style Projection IUnknown IVector<T> Array IVectorView<T> IObservableVector<T> C#/VB App CLR IEnumerable (T) style Projection IInspectable IUnknown HTML App Chakra JavaScript Projection IMap<T> Associative Collection IMapView<T> IObservableMap<T>
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
Threading MainUI thread Taskfactory Windows UI Object Windows Object Windows Object App Code App Code App Code
Architecture WinRT Language Support (CLR, WinJS, CRT) MetroApp Languageprojection UI Pickers Controls Media Web Host (HTML, CSS, JavaScript) Windows Metadata & Namespace XAML Storage Network … DirectX Windows Runtime Core Runtime Broker Win32 Windows Core
Runtime app Your App App Container + Signed & Validated code Core OS Process.exe WinRT APIs Direct API calls Broker Brokered API calls AppXManifest
Brokered Objects RuntimeBroker.exe App Proxy Projection IInspectable IUnknown Windows Runtime Object
Windows Runtime APIs User Interface HTML5/CSS XAML DirectX Controls Data Binding SVG Tiles Input Accessibility Printing Devices Communications & Data Contracts Local & Cloud Storage Web Geolocation Portable Sensors NFC Notifications Streams Media Memory Management XML Networking SMS Playback Capture PlayTo Visual Effects Fundamentals Application Services Threading/Timers Memory Management Authentication Cryptography Globalization
Sensors Accelerometer Gyroscope Compass Agitation Turn Overturning Slope In dark Indoors Outdoors Light Orientation
Areas of integration Together Contracts: Search Share With cloud Synchronization app settings Live SDK On Windows OS Live tiles Notifications Contracts Settings Print …
Pop-up notificationsToast Notifications Allow the user to go directly to the section of the app Show messages from apps and services outside the UI apps Attractattention Is disconnected Initiated locally or from cloud
Windows Push Notification Service Windows 8 Cloud Service Metro Style App 2 Serves 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 3 1 Notification Client Platform Windows Push Notification Service 3 Request for URL notification channel Serviceregistration Notifications