FUNCTIONAL ASPECTS OF GREAT NATIVE MOBILE APPS

Slides:



Advertisements
Similar presentations
What we will cover today… Where is the camera on my phone? Taking a photo Zoom in and out Deleting a photo Where do my photos go to? Viewing my photos.
Advertisements

Chapter 3 – Web Design Tables & Page Layout
Step-by-Step: Add a Graphical Hyperlink USE the Special Events Final presentation that is still open from the previous exercise. 1.Go to slide 4, and click.
KompoZer. This is what KompoZer will look like with a blank document open. As you can see, there are a lot of icons for beginning users. But don't be.
1. Chapter 29 Creating Forms 3 Understanding Forms Word enables you to create fill-in forms to eliminate the need for storing pre-printed forms. Add.
Who are these guys? Bruce Pulley Senior Mobile Applications Developer Andrew Rumbley Senior.
Site Modules > Page Builder Access the Page Builder module through the Site Modules top navigation link. Access Page Builder from the Site Modules navigation.
Microsoft Windows Vista Chapter 5 Personalize Your Work Environment.
®® Microsoft Windows 7 for Power Users Tutorial 2 Customizing Microsoft Windows 7.
© by Pearson Education, Inc. All Rights Reserved.
© by Pearson Education, Inc. All Rights Reserved. continued …
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
Tutorial Holdings Management Adding, Editing, and Assigning Notes support.ebsco.com.
Windows 8 Windows Phone 8 Web Mobile … and WakeUpAndCode.com.
Fundamentals of Programming in Visual Basic 3.1 Visual basic Objects Visual Basic programs display a Windows style screen (called a form) with boxes into.
NFD UI Design For Android Devices. Layout options Anchor navigation and actions. Its position at the top of a screen makes it ideal for presenting navigation.
New School Websites Teacher Pages. Visit the SCUSD Website for videos tutorials: For more information.
With Alex Conger – President of Webmajik.com FrontPage 2002 Level I (Intro & Training) FrontPage 2002 Level I (Intro & Training)
Module 3 Productivity Programs Common Features and Commands Microsoft Office 2007.
®® Microsoft Windows 7 for Power Users Tutorial 2p3 Customizing Microsoft Windows 7.
© 2011 Delmar, Cengage Learning Chapter 2 Developing a Web Page.
PROG Mobile Java Application Development PROG Mobile Java Application Development Event Handling Creating Menus.
Visual Basic Chapter 1 Mr. Wangler.
Copyright 2007, Information Builders. Slide 1 Maintain & JavaScript: Two Great Tools that Work Great Together Mark Derwin and Mark Rawls Information Builders.
 Understanding an activity  Starting an activity  Passing information between activities  Understanding intents  Understanding the activity lifecycle.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Dynamic Action with Macromedia Dreamweaver MX Barry Sosinsky Valda Hilley.
Programming with Microsoft Visual Basic 2012 Chapter 12: Web Applications.
Key Applications Module Lesson 19 — PowerPoint Essentials
Learning Microsoft Power Point Getting Started  There are three features that you should remember as you work within PowerPoint 2007: the Microsoft.
Teach Yourself Windows 98 Module 2: Working with Files, Folders, and the Desktop.
Chapter 2 Developing a Web Page. A web page is composed of two distinct sections: –The head content –The body Creating Head Content and Setting Page Properties.
IE 411/511: Visual Programming for Industrial Applications
Chapter 3 Introducing Visual Basic.NET. 3.1 Visual Basic.NET Windows Programming -Used to create Windows, Web, and Console applications -Uses predefined.
Using FrontPage Express. Slide 1 Standard toolbars and menus Time indicator: gives an approximation of download time of the page.
ASP.NET Web Server Controls Basic Web Server Controls.
Copyright 2012 Adobe Systems Incorporated. All rights reserved. ® Copyright 2010 Adobe Systems Incorporated. All rights reserved. ® Copyright 2012 Adobe.
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 4 I Need a Tour Guide.
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Domain 3 Understanding the Adobe Dreamweaver CS5 Interface.
Jeff Batt eLearning Brothers Product Development Manager B.Y.O.L.: Titanium - Create Mobile Training as a Native App Using Javascript Jeff Batt eLearning.
Microsoft Visual Basic 2005 CHAPTER 7 Creating Web Applications.
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
Computing Fundamentals Module Lesson 3 — Changing Settings and Customizing the Desktop Computer Literacy BASICS.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Introduction to JavaScript 41 Introduction to Programming the WWW I CMSC Winter 2004 Lecture 17.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Program Design and Coding
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2010 CHAPTER THREE Program Design and Coding.
Android Boot Camp for Developers Using Java, 3E
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 7 Key Concepts 1 Copyright © Terry Felke-Morris.
ACTIVINSPIRE TRAINING Tips and tools for creating Flipcharts on ActivInspire.
Creating an Example Android App in Android Studio Activity lifecycle & UI Resources.
Chapter Two Creating a First Project in Visual Basic.
Microsoft Access Lesson 2 Lexington Technology Center February 13, 2003 Bob Herring On the Web at
Powerpoint as a Multimedia Platform Matt Monjan Discovery Educator Network.
Chapter 1 Getting Started with Adobe Photoshop CS4.
Multimedia Capture & storage. Introduction A rich set of API for recording of audio & video. A developer has two choices  launch the built-in app using.
Chapter 2 More Controls Programming in C#. NET Objectives Use text boxes, group boxes, check boxes, radio buttons, and picture boxes effectively.
How to use STAT!Ref Online. Search The simplest way to search STAT!Ref is to enter the search term into the field at the top of the page and click the.
Chapter 3 I Need a Tour Guide (Introduction to Visual Basic 2010) Clearly Visual Basic: Programming with Visual Basic nd Edition.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Live. learn. work. play Superior Avenue Suite 310 Cleveland Ohio Tel: Fax:
ANDROID LAYOUTS AND WIDGETS. Slide 2 Introduction Parts of the Android screen Sizing widgets and fonts Layouts and their characteristics Buttons, checkboxes.
Using FrontPage Express
Presentation transcript:

FUNCTIONAL ASPECTS OF GREAT NATIVE MOBILE APPS

Functionality to go from good to great Why create a native mobile app if you aren't going to use the hardware that is hard or impossible to access in a mobile web app? Other functional considerations related to creating great apps We'll continue the conversation about "great apps" in Unit 5.

Accessing phone hardware E.g., Compass, Geolocation, Accelerometer, Shake, Sound, Camera Some of these are robustly supported only in certain mobile browsers (e.g., compass in Safari) but available and reliable in native apps Others are available in most mobile browsers (e.g., geolocation), but more features are available in native apps

Compass var win = Ti.UI.createWindow({ backgroundColor : "#FFFFFF", title : "test" }); var lbl = Ti.UI.createLabel(); win.add(lbl); win.open(); function display(e) { lbl.text = e.heading ? 'compass:' + e.heading.magneticHeading + ',when:' + (new Date()).getTime() : 'null heading'; // see also the trueHeading property, used along with location tracking } // you can get heading just once with getCurrentHeading() or you can monitor it… Ti.Geolocation.addEventListener("heading", display); // use removeEventListener when done!!

Geolocation function display(e) { lbl.text = e.coords ? 'lat:' + e.coords.latitude + ',lon:' + e.coords.longitude + ',when:' + (new Date()).getTime() : 'null coords'; } Ti.Geolocation.preferredProvider = Titanium.Geolocation.PROVIDER_GPS; Ti.Geolocation.purpose = "CS496"; Ti.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST; // can use lower accuracy Ti.Geolocation.distanceFilter = 10; // can use broader filter if (Titanium.Geolocation.locationServicesEnabled === false) { alert('You need to turn GPS on.'); } else { // to get location just once Ti.Geolocation.getCurrentPosition(display); // to continually get location Ti.Geolocation.addEventListener('location', display); // unregister with Ti.Geolocation.removeEventListener(display) when done with it! }

Accelerometer When the device isn’t accelerating, it’s more of a “gravity-meter” than an accelerometer var listener = function(e) { lbl.text = 'accel: ' + e.x + ';' + e.y + ';' + e.z; }; Ti.Accelerometer.addEventListener('update', listener); Ti.Accelerometer.removeEventListener('update', listener);

Shake Ti.Gesture.addEventListener('shake', fn); Ti.Gesture.removeEventListener(fn); // No API for just retrieving once (obviously?) // Seems to only detect really strong shakes (?)

Key cautions Accessing this specialized hardware is very battery-intensive Option #1: Just retrieve value once – Use setTimeOut every few minutes if needed Option #2: Register for the event listener – Look into the specialized APIs for filtering events E.g., "only fire a geolocation event on change >100 meters" – Unregister your event listener as soon as possible

Camera var win = Ti.UI.createWindow({ backgroundColor : "#FFFFFF", title : "test" }); var btnCamera = Ti.UI.createButton({ title : 'Take picture', top : 20 }); btnCamera.addEventListener('click', function() { Titanium.Media.showCamera({ success : function(event) { var photoTaken = event.media; if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) { var imgView = Titanium.UI.createImageView({ left : 10, width : 300, height : 300, image : photoTaken }); win.add(imgView); } }, cancel : function(event) { alert('cancel'); }, error : function(event) { alert('error'); } }); win.add(btnCamera); win.open();

Other functional considerations Great apps also have functionality for: – Validating inputs, managing state throughout an application's lifecycle – Taking advantage of relevant specialized user interface controls and views – Selectively applying platform-specific APIs

Input validation: Assuring that your app's state is initialized from user data correctly Sadly, form validation is very underdeveloped in Titanium Best approach is to: 1.Add labels to your form, for showing error msgs 2.In your button click handler, check every input (e.g., with regular expressions) 3.If an input is invalid, set an error message; else, clear error message(s) and continue.

Handling lifecycle events Apps can be paused and then resumed – For example, if user goes to home screen and then comes back to your app – iOS and Android have slightly different events, but Titanium hides some of this from you On pause, – Save any state that cannot be lost, release resources On resume, – Reinitialize from saved state, reinitialize resources

Example of handling lifecycle events Ti.App.addEventListener('pause',function(e) { // call removeEventListener for hardware // save user data to local storage }); Ti.App.addEventListener('resume',function(e) { // reload user data from local storage // call addEventListener for hardware });

You can also detect Android-specific lifecycle events Detecting your execution environment function isAndroid() { // iOS vs Android return Ti.Platform.name == 'android'; } Accessing Android-specific events (another video will cover the Android lifecycle in detail) Ti.Android.currentActivity.addEventListener('create', function(e) { // called when the app's current activity (window) is created }); Ti.Android.currentActivity.addEventListener('start', function(e) { … }); Ti.Android.currentActivity.addEventListener('resume', function(e) { … }); Ti.Android.currentActivity.addEventListener('pause', function(e) { … }); Ti.Android.currentActivity.addEventListener('stop', function(e) { … });

Speaking of which… Great apps take selective advantage of functionality that is platform-specific – Yes, this decreases portability – But it has the potential to improve the user experience and benefits given to users And use specialized user interface controls – That might be rendered in platform-specific ways

Judicious use of specialization Specialization driven by guidelines & hardware – E.g., guidelines: iOS apps use toolbars to navigate – E.g., hardware: Android phones have 2+ buttons FYI, you can also specialize images – Depending on platform and screen density (essentially dots per inch) – Customize using Resources subdirectories

ScrollView Rendered nearly the same on iOS & Android var win = Ti.UI.createWindow({ backgroundColor : "#FFFFFF", layout : 'vertical' }); var scrollView = Ti.UI.createScrollView({ contentWidth : 'auto', contentHeight : 'auto', showVerticalScrollIndicator : true, height : Ti.UI.FILL, width : Ti.UI.FILL, layout : 'vertical' }); for (var i = 0; i < 100; i++) scrollView.add(Ti.UI.createLabel({ text : "item " + i, color: '#000000' })); win.add(scrollView); win.open();

Picker Same code, rendered differently on iOS & Android var win = Ti.UI.createWindow({ backgroundColor: "#FFFFFF", layout: 'vertical' }); var picker = Ti.UI.createPicker({ selectionIndicator: true }); var items = []; items[0]=Ti.UI.createPickerRow({title:'OSU'}); items[1]=Ti.UI.createPickerRow({title:'UO'}); items[2]=Ti.UI.createPickerRow({title:'UW'}); picker.add(items); win.add(picker); win.open();

TabGroup Same code, rendered differently on iOS & Android // From the wizard-generated code… //create module instance var self = Ti.UI.createTabGroup(); //create app tabs var win1 = new Window(L('home')), win2 = new Window(L('settings')); var tab1 = Ti.UI.createTab({ title: L('home'), icon: '/images/KS_nav_ui.png', window: win1 }); win1.containingTab = tab1; var tab2 = Ti.UI.createTab({ title: L('settings'), icon: '/images/KS_nav_views.png', window: win2 }); win2.containingTab = tab2; self.addTab(tab1); self.addTab(tab2); You can just use Ti.UI.createWindow(…), FYI

CoverFlowView Only available on iOS var win = Ti.UI.createWindow({ backgroundColor : "#FFFFFF" }); var imgs = []; for (var i = 1; i <= 3; i++) imgs.push({ image : 'img' + i + '.jpg', height : '33%', width : '33%' }); var view = Titanium.UI.iOS.createCoverFlowView({ backgroundColor : '#00000', images : imgs, width : Ti.UI.FILL, height : Ti.UI.FILL }); win.add(view); win.open();

Toolbar Only available on iOS var win = Ti.UI.createWindow({ backgroundColor : "#FFFFFF" }); var btnReview = Titanium.UI.createButton({ title : 'Review', style : Titanium.UI.iPhone.SystemButtonStyle.DONE, }); // systemButton specifies a standard appearance (has nothing to do with behavior) var btnTrash = Titanium.UI.createButton({ systemButton : Titanium.UI.iPhone.SystemButton.TRASH, }); var btnCancel = Titanium.UI.createButton({ systemButton : Titanium.UI.iPhone.SystemButton.CANCEL }); var spacer = Titanium.UI.createButton({ systemButton : Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE }); var toolbar = Titanium.UI.iOS.createToolbar({ items : [btnCancel, spacer, btnTrash, spacer, btnReview], top : 0, borderTop : false, borderBottom : true }); win.add(toolbar); win.open();

Menu Only available on Android var win = Ti.UI.createWindow({ fullscreen : true }); var activity = win.activity; activity.onCreateOptionsMenu = function(e) { var menu = e.menu; for (var i = 0; i < 4; i++) { var menuItem = menu.add({ title : "Choice " + i }); menuItem.addEventListener("click", function(e) { alert("Your choice has been noted.") }); } }; win.open();