1 / 28

Non-Native Android Development

Non-Native Android Development. Stacy Devino Stephen Wylie 8/9/2012. Comparison of several non-native platforms. jQuery Mobile - Pros. S upports JSON E asy API integration Uses a Web View front end Prebuilt packages, theming easily drive professional results

asher
Download Presentation

Non-Native Android Development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Non-Native Android Development Stacy Devino Stephen Wylie 8/9/2012 (C) 2012 Stephen Wylie & Stacy Devino

  2. Comparison of severalnon-native platforms (C) 2012 Stephen Wylie & Stacy Devino

  3. jQuery Mobile - Pros • Supports JSON • Easy API integration • Uses a Web View front end • Prebuilt packages, theming easily drive professional results • Build mobile app &mobile site with same code • Supported on every smartphone platform • Quick prototyping and easy to "theme" using CSS (proto app in less than a day) (C) 2012 Stephen Wylie & Stacy Devino

  4. jQuery Mobile - Cons • Slow if large • Never as quick as native • Best for simple or web interactive applications (C) 2012 Stephen Wylie & Stacy Devino

  5. Phonegap - Pros • Full HTML5 viewer • Build & develop using familiar Web tools • Fast development with full cross compatibility • Easy to build with little native code • Plugins: • Many provided for interacting with hardware • Easy to roll your own for other features (NFC, BT, Native Android) (C) 2012 Stephen Wylie & Stacy Devino

  6. Phonegap • No limits to what you can add • Add all the packages for theming that you want • Use any IDE you want, compiling and upgrading is very easy Cons: • Slower than full native code • Requires you to do cross code hoping for something complicated • You have to be pretty smart to do add-ons that work well (C) 2012 Stephen Wylie & Stacy Devino

  7. Titanium - Pros • Generates full native code • Prebuilt packages  • Cross-platform for Android, iOS • Full IDE with many debugging features • Things work as expected (C) 2012 Stephen Wylie & Stacy Devino

  8. Titanium - Cons • IDE support from dev team is limited • Additional features not present • Creating new features nearly impossible • Only builds for iOS and Android • Hard to root-cause memory leak issues (problems from the IDE/package) (C) 2012 Stephen Wylie & Stacy Devino

  9. Sencha - Pros • Very fast for non native • Quick to learn and use for Web devs • Cross platform for iOS and Android • Can prototype on a web view • Very good HTML5 support • Built for web interactive, custom view content Best for simple custom apps with a static feature set that won’t expand after release (C) 2012 Stephen Wylie & Stacy Devino

  10. Sencha - Cons • Can take a while to build something novel • Libraries are not huge • Building new features can be a pain (C) 2012 Stephen Wylie & Stacy Devino

  11. Stackmob - Pros • Huge API, IDE support • Can service other apps  • Built for Java, JavaScript, and HTML5 • Build your own API's and combos • Oauth, advanced analytics support included • Can do advanced logic -- twitter, facebook, etc.-- quick learning curve for Android devs -- great for if looking to do a mash-up app -- HUGE if you have ever dealt with Oauth (C) 2012 Stephen Wylie & Stacy Devino

  12. Stackmob - Cons • Some features poorly supported across devices • Non-native code  • Must build in a native language (Java) • Documentation is not great  • Requires web connection to do anything useful (C) 2012 Stephen Wylie & Stacy Devino

  13. Development Time Comparison (C) 2012 Stephen Wylie & Stacy Devino

  14. Acloser look at PhoneGap/Cordova (C) 2012 Stephen Wylie & Stacy Devino

  15. PhoneGap (Cordova) + jQuery Mobile • jQuery: Robust JavaScript API for • Manipulating HTML DOM • Processing HTTP requests with AJAX • jQuery-UI: • Slick-looking user interface elements • Too slow for mobile use • jQuery Mobile: • Best of both worlds • Plenty of examples online (C) 2012 Stephen Wylie & Stacy Devino

  16. Cordova + jQM • QM provides mobile-inspired event listeners • Performance can be slow • Caused by 300ms delay waiting for additional touches • Work around with fastclick.js - https://github.com/dave1010/jquery-fast-click/ (C) 2012 Stephen Wylie & Stacy Devino

  17. Remember SliderSwitch? Here’s how to do it in JS & jQuery… (C) 2012 Stephen Wylie & Stacy Devino

  18. Plugins • Many default PhoneGap plugins provide access to extended device features • Accelerometer • Camera • Contacts DB… • Sometimes you need to roll your own • Extra sensor, memory-intensive view, etc. • Need a JavaScript portion & an Android intent (C) 2012 Stephen Wylie & Stacy Devino

  19. Plugins - JavaScript • Cordova.exec() invokes native code • Requires five arguments • Success callback (JS function) • Failure callback (JS function) • String reference to native code class • String reference to an action • Array of parameters (C) 2012 Stephen Wylie & Stacy Devino

  20. Plugins - JavaScript varMenuIntent = function() { }; MenuIntent.prototype.startActivity = function(city) { return PhoneGap.exec(function(args) { menuSuccess(args); }, function(args) { menuFail(args); }, 'MenuPlugin', 'startActivity', [city, selectedCheckArr, specials]); }; // Called by: window.plugins.menuIntent.startActivity(city); (C) 2012 Stephen Wylie & Stacy Devino

  21. Plugins – Native Java • Override the Plugin class • Implement the execute function:public PluginResult execute(String action, JSONArrayargs, String callbackId) • Implement means to return resultsPluginResult result = new PluginResult(PluginResult.Status.[OK|ERROR], data);result.setKeepCallback(false);this.[success|error](result, this.callback);this.callback= ""; (C) 2012 Stephen Wylie & Stacy Devino

  22. Plugins – Native Java • Could write the whole plugin in execute() • Need further modification to await asynchronous results • User input, file download, etc. (C) 2012 Stephen Wylie & Stacy Devino

  23. Example • menuplugin.js • MenuPlugin.java (C) 2012 Stephen Wylie & Stacy Devino

  24. SQL DB Substitutes Build your backend with APIs & the cloud. • Extremely NoSQL approach • Data stored as “array of arrays” • Write your own API to access data Two popular choices: • Proxomo • APIgee (C) 2012 Stephen Wylie & Stacy Devino

  25. SQL DB Substitutes (C) 2012 Stephen Wylie & Stacy Devino

  26. SQL DB Substitutes • “NoSQL” means NO SQL. • No Joins! • Not constrained to a schema • How do you join? • Denormalize your tables  keep them in sync • Implement join logic in application layer • Data validation is up to you • Think of last time with Linden Darling  (C) 2012 Stephen Wylie & Stacy Devino

  27. SQL DB Substitutes • Setting up the API can be painful • So many queries & data interactions • Lots of repetitive code • Take security into consideration • HTTP GET is totally plaintextvalidateUser.php?user=stevo&pass=stockmktking • Use HTTPS wherever possible (C) 2012 Stephen Wylie & Stacy Devino

  28. Example • qw_ajax.php (C) 2012 Stephen Wylie & Stacy Devino

More Related