370 likes | 463 Views
Mobile & Tablet Development for Business. Background and Some Facts. IPhone revenue greater than all of Microsoft's Android activations hit 1.3M per day Microsoft launches Windows 8, focused so much on mobile computing ( Risky bet ?). World Traffic. Mobile Development Approaches.
E N D
Background and Some Facts • IPhone revenue greater than all of Microsoft's • Android activations hit 1.3M per day • Microsoft launches Windows 8, focused so much on mobile computing ( Risky bet ?)
Mobile Development Approaches • Native applications • Web based, mobile sites, Html 5 ? • Hybrid, Native + Mobile web based.
Native VS Web Based • Native refers to program that has been developed specifically for use on a particular platform or device • PROS: Fastest, Best look and feel, Full control of hardware, take full advantages of OS can offer. • CONS: Native application is usually developed by low level language, Machine Specific
Some Facts of Native applications on Android and IOS • IOS native application has to be developed on MAC OS, no windows SDK • The Main Programing language is Objective-C, No Java. • Objective C is very weird, Huge learning curve. • -(return_type)instanceMethod1:(par1_type)par1_varName:(par2)par2_varName; • They use + , and – to define class level method or static method, the use of bracket is out of your expectation, • this is a method call • [NSDictionarydictionaryWithObject:someObjectforKey:@"key"]; • Memory leak ? • LLVM Compiler, automatic memory management of Objective-C objects
IOS - Continued • Apple Developer Account, Submit your application to apple to review, it takes up to 2 weeks before it can be live. • Apple can reject your application, take it offline. • Imagine what about a critical security fix for your application ? • There are very limited services that can be run at OS level background, there are no cron job style stuff. • Application runs on Sandbox, self contained folder
Android • JAVA!!! • Android account for 70% of market share. • Problems: Fragmentation, OS is not always latest, Too many Resolution, Compatibility • Much less limitations on what you can’t do • Android emulator is slow, real device debugging. • Applications can be freely distributed
Mobile Web / Html 5 • Applications running on browsers. • Write once, run everywhere. ( Or really ?) Html 5 seems the best option to go. • What html 5 can do? • To name a few: GEO location, web workers, local DB, drag and drop, (check your gmail), web offline cache, Extensive Graphics Fancy stuff, 3d CSS, SVG, hardware acceleration
HTML 5 contiuned • Mobile Platform is the best place for HTML 5 • Html 5 depends on the browser capability. • Html5test.com
Html 5 detection • Best practice for html5: use javascript to detect. • If(suchHtml5FeatureSupported){ do Fancy() }else{ do ordinary( } Further more …
Compatibility • Html 5 based web apps are browser specific • How to minimize effort , compatibility ? • Use popular js mobile framework. • Eg. Jquery Mobile & Sencha Touch
Jquey Mobile VsSencha Touch • Jquey Mobile has the best compatibility, supported by almost all the mobile browser, Easy to develop. • It is Jquery • Sencha Touch only Support webkit based browser, that cover’s 95% + of the market • Sencha Touch Super Fast and Smooth, very similar to native experience, due to webkit hardware acceleration, but it is hard to develop • Based on Ext js framework , steeper learning curve vsjquery
Third Approach • Hybrid (Native + web ) • This is the most popular approach for the lots of companies • mobile banking or mobile financial app use this • Benefit: • full control on the core application part, eg, No need to wait for apple’s approval • Balance between user experience and development cost • Reuse current skills
Hybrid Application • How does it works? • Usually when build an native app, you can invoke an mobile browser component, • Eg, Pseudo code, just to show concept • UIWebViewmyBrowser=new UIWebView(); myBrowser.loadPage(“localpage.htm”) myBrowser.sendRedirect(“www.zenmeo.com”) More importantly, the page inside the myBrowser can interoperate native code with little effort, Namely , native code can listen to the js events inside webview
Hybrid Application - continued • Imagine possibility, you can invoke camera function in a js/html button • Hang on, still too hard? Still need some knowledge of native development? • There are more options to achieve this. • Frameworks…
Hybrid Application - Framework • Adobe Phonegap, adobe adobe just bought it 2 years ago. • Basically what it does is just as aforementioned approach. • It creates a stub of native code which contains a webview, and provide a bunches of very easy to use java script API which has been mapped to hardware. Eg, You can use JavaScript to read file , download file, access database
PhoneGap • PhoneGap does not provide UI API, all the java script API it provides is used to map hardware functions. • Eg: navigator.camera.getPicture( cameraSuccess, cameraError, [ cameraOptions ] ); • UI can be done use plain html / html 5/ js or even jQuery / Sencha Touch. • The application built by phoneGap or those hybrid approach can be download from app store and looks very alike to native apps.
Adobe Air • Flash is a failed project in mobile. adobe’s mobile strategy took 2 approaches: • Phonegap / Html 5 / hybrid way. • Adobe Air. Using action script , It is a dialect of ECMAScript, similar to java script. Adobe provides a runtime environment which can execute the compiled air application, similar concept of java and jdk. • Cross platform? Yes , No, IOS / Android
ZK framework • ZK framework has been nominated as our Java Team UI Framework • ZK framework since 6.5 has been announced to be Mobile Ready • Worth Trying , I haven’t yet • We can use ZK in conjunction with PhoneGap or Native Code
Appcelerator Titanium • Very Fancy, too Many magical stuff • You write javascript , this framework compile to Native executable. • It really works, however when the application build up to large scale, problems and issues arise. • Not enterprise ready use at this stage, maybe in future
Mobile Website Debug • Mobile Browser different from desktop browser • No view source button in mobile browser. • How to check javaScript errors ?
Server Side • JSON is most widely used over xml • Server side usually render 2 sets of content based on user agent. • Plenty plugins for desktop browsers to impersonate to mobile browsers, so you can see what the content will be rendered. (User agent spoofing )
Some References • Preparing Your Web Content for iPad • https://developer.apple.com/library/safari/#technotes/tn2010/tn2262/_index.html • http://javascriptweekly.com/ • http://jquerymobile.com/ • http://www.sencha.com/products/touch • http://diveintohtml5.info/ • If you need only 1 java script book, and don’t want to read some thing to thick ---