Creating 'Native' Cross-Platform Apps
Total Page:16
File Type:pdf, Size:1020Kb
Creating 'Native' Cross-Platform Apps Brameshmadhav S • To the Future! Agenda • React Native • Native Script • Demo To the Future PhoneGap took us this far, but is it time to move on? Understanding the Spectrum Full Capability Titanium ReactNative Cordova | Xamarin Adv. UI interaction Web Developer Skills Fast performance Native Hybrid Access to native platform App store distribution App store distribution Single Multiple Platform Platform That poor HTML5 Long time ago I thing Web Developer Skills was THE thing. Instant updates Not anymore Partial Capability App Development Approaches Web Application Hybrid Application Mixed Hybrid Application Native Application • Runs on Mobile Browser • Web code executed • Augment web code with • Developed using native • HTML/CSS/JS within native container Native SDK to create SDK Programming model • Native WebView or unique experience • Native appearance and • Dynamic Web Cordova Wrapper • Native and Web device capabilities Application or Ajax • HTML/CSS/JS components coexist • Backend integration Application or Single components are • Take advantage of best using REST JSON/XML Page Apps packaged with the app of both approaches web services • No device Feature • Backend integration • Backend integration • Distributed through Integration using REST/JSON (Not using REST JSON web appstore • Not distributed through HTML) services appstore, easier • Distributed through • Distributed through adoption appstore appstore Native Mobile Experience/Capabilities/Services/ Portability (Cross Device Reusability) Maintenance Cost (TCO) React Native The website you want to convert to an app React Native • Uses similar philosophy to React • Virtual DOM is the new playground • In brief, the application UI is simply expressed as a function of the current application state • Competes with Appcelerator Titanium • Application logic is written and runs in JavaScript, whereas your application UI is fully native. • Therefore you have none of the compromises typically associated with HTML5 UI. • Open source! Getting started with React Native . npm install -g react-native-cli . react-native init <project-name> . For iOS : • <project-name>/ios/<project-name>.xcodeproj . For Android : • react-native run-android from the project folder . This will open a terminal which will help live reload the project . Usually at : http://localhost:8081/index.ios.bundle Demo Summary – React Native • All the goodness to Titanium packaged with brand Facebook • The concept of virtual DOM driving React is so amazing • Amazing Community support and traction • React native for Android was released less than a month ago • Production ready? Yes and No • Facebook Groups app runs completely on this NativeScript Do you need to know the web to write cross platform mobile apps? != No DOM NativeScript A runtime for building != and running native iOS, Android, and (soon) Windows No cross compilation Phone apps with a single, JavaScript code base != Direct access to native APIs in JS Why NativeScript? • Skills reuse • Standards-based JavaScript, CSS, optionally TypeScript • 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! How Does NativeScript work ? NativeScript runs JavaScript on a JavaScript VM • JavaScriptCore on iOS • V8 on Android NativeScript Modules • NativeScript-provided 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). https://www.npmjs.com/search?q=nativescript NativeScript CLI • npm install –g nativescript (https://github.com/nativescript/nativescript-cli) • System Requirements • Android : JDK, Apache Ant, Android SDK • iOS : Xcode, Xcode CLI tools, iOS SDK • tns create <project name> • cd <project name> • tns platform add ios | android • tns run ios | android --emulator • Backend-as-a-service • Push notifications, cloud data, file storage, etc. • Analytics • AppBuilder • Cloud builds (build iOS apps on Windows, Windows Phone apps on a Mac) • NativeScript debugging and tooling • Screen Builder (app scaffolding) • IDE extensions • Paid service with 30-day free trial • https://www.telerik.com/purchase/platform Demo Summary – NativeScript • The power of true native apps at your disposal! As simple as that • Hybrid mobile apps are of the past. Time to look at the Future-Past • https://www.nativescript.org/showcases shows all the apps built with Native script. It’s pretty nascent. • Backed by Telerik with their Telerik Platform model • Community support is excellent Thank you, © 2015 SAPIENT CORPORATION .