Building Native Mobile Apps with Angular 2.0 and NativeScript

Slides:



Advertisements
Similar presentations
Who are these guys? Bruce Pulley Senior Mobile Applications Developer Andrew Rumbley Senior.
Advertisements

Native vs hybrid vs web mobile Application
The PhoneGap History Doncho Minkov Telerik Academy academy.telerik.com Technical Trainer
Mobile Development with Xamarin Mark Allan Ranyart
Lightning Talk Fred Rodriguez Nguyen Do CPSC 473 May 6, 2012.
Title slide to be used at the start of a module. Developing Mobile Apps Roland Guijt
Mobile App Support Jacob Poirier Geri Hengesbach Andrea Menke Erin Rossell.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Android Programming By Mohsen Biglari Android Programming, Part1: Introduction 1 Part1: Introduction By Mohsen Biglari.
Introduction CIS 136 Building Mobile Apps 1. What is a mobile app? 2  Computer program  Designed for small devices  Smartphones  Tablets  Other handhelds.
Java Mobile Apps with GWT & PhoneGap Josh Marinacci, webOS Developer Advocate.
Introducing NativeScript [Pavel Kolev Software Telerik: a Progress company]
Android for Java Developers Denver Java Users Group Jan 11, Mike
Google Web Toolkit An Overview By Shauvik Roy Choudhary.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Microsoft UI Stack Ronnie Saurenmann Technical Evangelist, Microsoft Switzerland
Trunica Inc. 500 East Kennedy Blvd #300 Tampa, FL Cross Platform Mobile Apps With Cordova and Visual Studio 2015 © Copyright 2015.
The way of hybrid mobile development Hybrid Mobile Applications Telerik Software Academy
Using NativeScript to develop native apps for IOS and Android
Game on! With Nativescript
Plug-in Architectures Presented by Truc Nguyen. What’s a plug-in? “a type of program that tightly integrates with a larger application to add a special.
Web Components Polymer. Agenda I want bootstrap : 3 Today.
Created by Presented by James Schultz Titanium. What is Titanium? An open, extensible development environment for creating beautiful native apps across.
Flux & React Web Application Development Mark Repka, Rich McNeary, Steve Mueller.
 Can access all API’s made available by OS vendor.  SDK’s are platform-specific.  Each mobile OS comes with its own unique tools and GUI toolkit.
NativeScript – Open source platform to build Native iOS/Android Apps.
Getting Started with Angular 2 and TypeScript Nebraska.Code() 2016 Spencer Schneidenbach Ryvit.
丁建文 國立高雄應用科大資管系副教授 兼任計網中心軟體發展組組長 跨平台行動應用軟體開發技術 : HTML5 & Mobile JavaScript Framework 暨南大學.
INTRODUCING HYBRID APP KAU with MICT PARK IT COMPANIES Supported by KOICA
Best Web Technologies for
#SummitNow Alfresco Mobile SDKs in Action 06 November, 2013 Mike Hatfield Lead Engineer Mobile Apps, Alfresco.
Build Hybrid Mobile Apps with Ionic, Angular, & Cordova Brian
Ionic Mobile App Development Services
Software services delivering SharePoint, Mobile, and Business Intelligence solutions Creating mobile applications that integrate with SharePoint 2013 on-
A little more App Inventor and Mind the GAP!
Windows Communication Foundation and Web Services
Geospatial Research & Solutions GIS.ASU.EDU
Introduction to Xamarin C# Everywhere
Android Mobile Application Development
NativeScript Open-source framework for building truly native mobile apps with Angular, TypeScript or JavaScript. Thanks everyone for coming out today.
State of the Art in Mobile Development
Building Desktop Apps with Node.js and Electron
Physics validation database
Angular 4 + TypeScript Getting Started
JavaScript: Good Practices
Introducing NativeScript
Apache Cordova Overview
@NicJ
Hybrid Mobile Applications
Windows Communication Foundation and Web Services
User Interface / User Experience Demo
CMPE419 Mobile Application Development
Survey Paper & Manuscript
Best Angular 2 interview questions and Answer that have been designed for Angular 2 programmers who are preparing online interviews on Angular 2 interviews question. Visit Website:
A lot of Software Development is about learning
React Revived Web Driver IO for Testers
Angularjs Interview Questions and Answers By Hope Tutors.
Modern web applications
Lecture 1: Multi-tier Architecture Overview
12/5/2018 HCI SNS College of Engineering Department of Computer Science and Engineering Mobile Application Development Presented by S.Yamuna AP/CSE.
Modern web applications
.Net Framework Details Imran Rashid CTO at ManiWeber Technologies.
Android Platform, Android App Basic Components
Introduction to AJAX and JSON
Introduce to Angular 6 Present by: Võ Văn Hào
Web Client Side Technologies Raneem Qaddoura
CMPE419 Mobile Application Development
The Future is Now with ASP.NET Core 3.0
Blazor A new framework for browser-based .NET apps Ryan Nowak
SharePoint Saturday Kansas City October 19, 2019
Presentation transcript:

Building Native Mobile Apps with Angular 2.0 and NativeScript Alexander Vakrilov @ufsa

For the past 10 months (from May 2105) we’ve been working directly with the Angular team to bring Angular 2 and NativeScript together… We are doing this to provide the same experience of building mobile apps as it is for web apps. And thus allowing Angular 2 developers to reuse their skills. [or maybe like this?? We are doing this to enable Angular 2 developers to build native mobile apps the same way as they are building web apps.]

Tobias Bosch Hristo Deshev So…Every Tuesday starting from May: the lead developers from the Angular Team [picture of Tobias Bosch] and Telerik Team [picture of Hristo Deshev] met using Google Hangouts to plan… (next slide)

Mobile App World Domination

The first entry from the Google docs From the very beginning the idea was to take advantage of Angular’s Platform Agnostic architecture and expand it by adding NativeScript specific components.

Angular 2 meets NativeScript Platform Agnostic Platform Specific HTML Parse5 Compiler Proto Views NativeScript Renderer Native Visual Tree Markup Dom Adapter Compiler Proto Views Renderer Visual Tree (1)We decided to use HTML as the Markup language, which gave us an opportunity to (2) use Parse5 as the DomAdapter. (3) + (4) Because of the way Angular is designed we didn’t have to do anything to the Compiler or the compiled Proto Views (templates) (5) The real work was in implementing our own Renderer, which generates a Native Visual Tree and is capable of propagating property changes and events between ProtoViews and Native Visual Tree… both ways.

NativeScript Checkbox with Angular 2 Component Class All this means that you can create Angular 2 Modules for NativeScript. And as expected your component will be made of: a Component definition – where we define the selector, properties and events Then we define the View And finaly complete it with a class definition that contains the javascript that controls the module But don’t worry we will show you this component in action shortly. … So what is NativeScript?

What is NativeScript? A runtime for building and running native iOS, Android, and (soon) Windows Phone apps with a single, JavaScript code base

!= != != No DOM Direct access to native APIs in JS JS vs. C# {N} vs PhoneGap and Ionic {N} vs Xamarin {N} vs React Native and Appcelerator (Titanium) – check it!!!

Skills reuse Code reuse Easily use native APIs Open source! Why NativeScript? Skills reuse JavaScript and CSS Angular2 Code reuse npm modules, 3rd-party iOS and Android libraries Easily use native APIs No wrappers to access native APIs Use native UI elements Open source!

Bridge

NativeScript Android example Output: I'll give your brain a minute or two to parse this, because yes, this JavaScript code instantiates a Java android.text.format.Time() object, calls its set() method, then logs the return value of its format() method, which is the string "01/01/15".

NativeScript iOS example This JavaScript code instantiates an Objective-C UIAlertView class, sets its message property, and then calls its addButtonWithTitle() and show() methods. When you run a NativeScript iOS app with this code you'll see the alert below:

How does this work?

JavaScript Virtual Machine This is going to be like trying to explain a magic trick, so I hope it won’t take the magic out of it. NativeScript is not just a set of libraries, but more of a Runtime that enables you to call native APIs: for Android, iOS and Windows Universal It uses a pre-packaged JavaScript Virtual Machine. To be precise: •For Android it is – Google’s v8 JavaScript Engine, •For iOS and Windows Phone it is – WebKit’s JavaScriptCore

Calling Android API var file = new java.io.File(path); which calls Android API to create a file object. The JavaScript Virtual Machine or in this case Google’s v8 JavaScript Engine, evaluates the code.

Calling Android API The Type Conversion Service converts the path value, from the JavaScript String to the native Java String object.

Calling Android API Metadata will lookup the Android API and determine the corresponding native method to call and as a result finding the native constructor for the File class.

Calling Android API <Before the next slide> The call dispatcher executes the call with a dual result: •On the Android Side: we get a new instance of the native File class •On the NativeScript Side: we get a custom JavaScript Object serving as a proxy to the native Android’s object When a method is called on this proxy it is delegated to the underlying native object. <Before the next slide> This is the foundation of the NativeScript framework. The next logical step was to create a platform agnostic abstraction layer. It is really great that you can access native APIs straight form JavaScript. But I can hear you think. … this still doesn’t solve the problem of me having to learn all those Platform APIs. But this is just the foundation of the NativeScript framework.

Metadata Generating Process = We don’t have a bunch of people who build the API translations for each platform. But instead we have the {N} Metadata generating processes – the way it works, if you point it at Android SDK it will build the representation of everything in there. All functions and types. And the same thing happens for iOS as well. Metadata gets rebuilt every time you build the app. And to make it better, if you add a 3rd party Native plugin/library, the Metadata generating process will also include the additional metadata. So because of that mechanism {N} provides Day Zero support. So when a new version of a platform comes out, all you have to do is rebuild your app against that version of the platform. For instance we already support Android M, which was announced at Google io. Without us having to make any changes to the bridge.

Code Modules Platform API NativeScript modules NativeScript comes equipped with modules that provide cross-platform functionality. There are dozens of them and they’re easy to write yourself. NativeScript modules follow Node module’s conventions (CommonJS).

NativeScript file module

HTTP module example

The big picture XMLHttpRequest <NS Module> Native iOS call Abstraction Layer XMLHttpRequest <NS Module> Implementation Native iOS call Native Android call Destination iOS App Android App Now let’s look at the bigger

<Angular Component> The bigger picture Abstraction Layer HTTP <Angular Component> XMLHttpRequest <NS Module> XMLHttpRequest <Browser> Implementation Native iOS call Native Android call Ajax call Destination iOS App Android App Web App Now let’s look at the bigger

[class.style1]="expression" One syntax for all Attribute Binding: [attribute] Event Binding: (event) Intercepting input: #idhandler Conditions: *ngIf="expression" Loops: *ngFor="expression" Styling: [class.style1]="expression" For goodies check Angular 2 cheatsheet

CSS

http://docs.nativescript.org/styling#supported-properties

The difference is in the UI Web UI != Mobile UI This might be obvious

Native Layouts Absolute Dock Grid Stack Wrap

DEMO

Q & A

tinyurl.com/bws-workshop Rough Workshop tinyurl.com/bws-workshop