webapps vs native apps - iphone

What is the biggest limitation of making/using webapps?
I'm thinking that when you use localstorage, offline-browsing and geo-abilities thaht you get from html5 the differences are quite small (except for games).
The great benefit from using webapps is that they are cross-platfrom compatible!

One of the biggest limitation is access to hardware. You can't access USB ports, specialized hardware you might have (printers, bardcode readers), and other stuff, and of course, you don't have access to some very important APIs that you need today to run games (DirectX, OpenGL).
But I agree: every day they are fewer reasons to not go with a WebApp instead of a Native APP.

For iOS: When using geolocation for webapp, the user will get prompt about giving location access every time, which could be annoying for the user. Native app, only the first time.
The UI performance is also not as smooth as native. Scrolling in webview has a "slower" acceleration compared to native view scrolling.

Performance is one major difference. I see from around 20X to over 200X speed improvements when converting from Javascript to compiled C/Objective C code. One can also do real-time audio and video processing in native code, as well as low-level networking, etc.

One interesting limitation (HTML5-wise) I see is from a point of intellectual property. Since a lot of code (raw JavaScript + HTML) is exposed to the user, you have to carefully decide which components will be "open" to end users. Not aware of any standard way to lock or hide your IP once it leaves your server.

Webapps are great for reaching multiple hardware devices, you can update your app a lot faster, thus feedback is quicker. However, your users will require an always-on internet connection to use your webapp, that's probably the biggest negative about them in comparison to a native (offline) app.

Related

What is the best way to make apps portable across mobile platforms?

I am working on an app for Android, but would like to have it ported in the future to iPhone and (if it seems to gain significant market share in the future) WP7/8.
I know nothing about any mobile platform other than Android. Should I be using C++ (NDK), Java, or something else to get as much portability as possible? I assume I will have to rewrite (or have someone rewrite) at lest part of it, but I would like to make as much of the codebase as possible portable.
Edit: It is a simple app that "scans" a barcode (camera) or has the number typed in, sends some information to a server, gets back some more info (probably in XML, but could be whatever works best) and displays it in a few simple screens.
Edit 2: The 4 parts I have, and would like to ideally make them portable are:
Scan a barcode (probably the hardest to make portable)
Allow entering a barcode number manually
Send and receive some custom data
Display a few screens (This can be in HTML, if I have an option to make it look "native", not like the browser window displaying a webpage it is)
For a non-trivial app that isn't a game, there are currently no mature solutions to this problem.
Tools like Titanium Mobile and PhoneGap are meant to help you do exactly what you want, but impose limitations on what your app can do and are so far at the cutting edge of development that they often introduce bugs of their own that you won't be able to fix. Additionally, you're at their developer's mercy when it comes to support for alternative platforms like WP7 or Blackberry. In some cases, these might be worth the risk, or you may get lucky, but you need to be wary before rushing to use them.
Often, the best technique is still just to develop independent codesbases. You can model them after each other in architectural terms, and if you do so it isn't typically that hard to translate between different platforms.
Another technique to aid in portability for many apps is to use embedded web browsers where it makes sense. This allows you design some of your views in HTML/CSS/Javascript rather than with native UI tools, and then just load them into the aforementioned embedded web browsers on each platform.
Depends on how many platforms you are aiming for.
I have some experience doing iPhone + Android. Honestly, I wouldn't spend too much time trying to learn a portability tool on top. I have done couple of apps (simple communication stuff + a light weight game) and my experience is so far - assumed you are familiar with both - it is far faster + easier to just write your app and then port it.
Besides the normal coding work, the most difficult tasks are to develop the app structure including the main classes and data structures - this you can copy basically 1 to 1 in terms of structure of course - not code.
Also since you will keep getting updates on different platforms like iOS (Android + Eclipse are a little slower it seems to come up with updates/upgrades), which make life easier all the time, you would most probably have a big disadvantage when relying on someone elses portability development toolkit.
So far - certainly not to be taken as a general rule - while development on iPhone took 100%, porting it on Android took at most 30-40%
This question is way too broad, it depends on what kind of app you're doing.
Generally speaking, if you're just as good off doing a web app, do that. It'll work across different platforms.
MonoTouch / MonoDroid by Xamarin (previously owned by Novell) allow you to write C# (the language used by WP7) for iOS/Android, respectively. It is not free, however.
I don't believe the frameworks go so far as to include cross-platform UI, but I'd say that's probably a good thing. At least your application logic can remain the same across platforms.
I've not used the framework myself, so I cannot vouch for it.
We do use MonoTouch/MonoDroid and it helps us to simultaneously support WM/WP7/Android/iOS. The common denominator of all these platforms (after employing Xamarin products) is .Net.
The policy of our company is to maintain toolkits for all platforms that provide similar UI. Then the apps can be written in a nearly platform-agnostic way. This isn't, however, a general statement as the independency refers to the specific types of applications.
I don't advise using our toolkits for your case as it looks like an overkill. However, investing into C#/.Net might not be a bad idea.
U should definitely go with the easiest route: Java.
You will still have to rework a lot while porting, but if you were using NDK, the overhead for Android itself might be similar.
(In an average app. As you havent provided too much information about the project, the answer couldnt be more specific. If you are developing a performance-critical app, like a 3D game, you should consider NDK for the high porfile program parts).
Edit: for this scanning solution, I would go with Java on android and wont bother with portability. For a project with such a clean application logic it wont worth the effort to make it portable (except if the aim of the project is to experiment with application portability, but as far as I got it, it isnt).

Crossplatform framework is suitable to do all things in Mobile Application as Native?

I am working in iPhone SDK.I have to convert from it to Crossplatform which may be either phonegap or titanium.As a iPhone Native application developer, I have some questions based on cross paltform.please consider the questions for other platforms android,etc also.I have already seen the stackoverflow Link.
1)Is it possible to get equal functionalities of all APIs which are in iPhone SDK through HTML5 and javascript?
2)If Apple releases New Version of iPhone SDK,will New APIs be included ASAP in Crossplatform?
3)If The App crashes in some situation, can I fix immediately through Device Debugging as we do in native Language?
4)The applications developed by Cross platform will be approved by Apple legaly?For example If i want to do live streaming in iphone , The restrictions have mentioned in Apple website.has it been followed by crossplatform?
5)will Application developed by cross platform take more memory?I mention the size of device build for appstore?If we develop the same through objective C,will size be reduced?
***My Conclusion is When we want to develop simple Applications for Multiple devices,crossplatform is suitable.Am I right?***I hope doing through native language(iphonensdk, Android) will avoid lot of Unnecessary things.
No.
If the API can be made available, it depends on how fast the creators of the framework implement it.
In principle, yes, as those frameworks employ a limited amount of OS capabilities to run web-technology (in most cases). This "wrapper" behaves as any native app does. For the content however the rules of the frameworks development language apply. It may be harder compared to native development to track down errors, since they must "pass the shell". Html errors for example may produce the same error for their enclosing webview again and again, despite being different in origin.
Propably.
That's hard to tell. It may depend on the framework. I wouldn't worry about the code as other ressources like imagery are usually the heavier load. But it may be very well the case that those frameworks bring along imagery necessary for their UI elements, since they do not rely on OS elements entirely. Compared to a native app which comes with no extra ressources at all, a crossplatform app with the same functionality might take more memory.
As to your conclusion: You're right. However I'd still encourage anyone to develop native applications whenever possible. Crossplatform frameworks tend to be slower at runtime and, in some cases, produce very ugly apps. I know several examples of apps which have been created with a variety of crossplatforms and I don't like any of them. They just don't feel right. Partly that's due to their UI elements which don't look and feel as you'd expect it on the platform you're on.
The principle behind crossplatform frameworks may appear to be logical, tempting and in some cases, straight economics mandate their use. But, for the time being, I find the results far from being satisfactory and for that reason would never touch a crossplatform framework.
In my experience (with a closed, private, expensive x-platform thing purchased by the employer), it was utterly frustrating, and incredibly difficult. Therefore, it is my preference to maintain multiple native apps.
The UI considerations that can be made/handled by the native app, as well as the functionality and speed gained by doing it natively, IMHO, far outweigh the benefit of having to write it 2 or 3 times.
In an ideal world, you would have a specialist for each platform that can lead the team on the "deep" things, and then everyone can generalize for all of the platforms, increasing their depth through the course of the project.

How to Performance Tune a jQuery Mobile iOS/Android Web App

I've been developing a web app using JQM to target iOS and Android devices. For much of the start of the development, I have developed and tested using Chrome (currently v13) on the desktop. As we get closer to our production release deadline, I have increased testing on physical iOS and Android hardware; the difference in performance between the desktop and mobile browsing experience is enormous.
The client/server interaction is very simple. The client requests a set of views, which the server returns. The client can then request the set of nodes associated with a particular view, which the server will return in a single payload. The client then generates the DOM for each node from the corresponding XML.
I have begun testing with XML payloads at or greater than 400kb. On the desktop, in Chrome, this is no issue. On mobile, in Mobile Safari, my DOM load times alone can be close to 12 seconds. Interactions with the DOM (which trigger updates to the XML, cached in localStorage) can take up to 5 seconds per click.
While I can think of half a dozen different ways to optimize my client/server communication--I can't figure out how to measure the expense of my individual method calls from the mobile client. I know that a 400k payload is too much for the iOS Mobile Safari, but I don't know whether the performance cost I'm incurring comes from traversing the DOM or manipulating the XML.
How can I perform metric analysis of my mobile web app from the perspective of the mobile client? Performance tuning to the desktop isn't getting me anywhere, and I don't have an equivalent developer console/FireBug on the mobile side.
How do other mobile developers solve this problem?
I've decided to add a simple start/stop logging button, which calls a logging function which stores method timing data in sessionStorage. On stop logging, I ship this to a web service for analysis through a desktop browser.
Edit: I did try JsLitmus per this SO post, but I concluded that the only performance test that really matters on mobile is the time to execute any particular function. Once I had this information exported out of the client, performance tuning was trivial.
I don't know what sort of XML parsing JQM uses, but if it's using a DOM style parser, performance will suffer for sure. Mobile clients deal better with pull style parsers (they're less memory intensive). DOM style parsing of XML is really slow in native clients, I bet it will be even slower inside a browser.
A 400 KB XML sure sounds like quite a big chunk of data. Do you really need all that at the same time?
Heavy DOM manipulation has never been cheap, I expect performance will be pretty affected in a mobile device.
I guess this doesn't really answer your question, but it was pretty long to just place inside a comment.

How can I code an efficient mobile site like gmail's?

My web site has a different mobile version that's suited for iPhone/Android devices. The problem, however, seems to be in the site's performance. It's really slow and heavy, even though I'm not loading any images.
On the other hand, when I use Gmail's or YouTube's mobile version, they're so fast they almost perform like a native mobile application.
How do they do that?
Your help is much appreciated :)
See my comment. Also, if the slowness you perceive is when interacting with the site it could be that it lacks the ability to accept touch events. On mobile web, if you have not wired up the UI for js touch events the experience will seem slower because the device browser has to fall back to standard click and other mouseevents which are not optimal. Frameworks such as mootools and jquerymobile/jqtouch have these events baked in. Take a look at the mootools solution which has quite a good write up: http://davidwalsh.name/mootools-touch
They probably making use of local storage http://dev.w3.org/html5/webstorage/
Are your pages too large? Try to use gzip and/or reduce output
Your server's connection speed may also be responsible of slowness
Well, You don't need to include any javascript framework to make it fast clickable.
By implementing some JavaScript you can achieve that. Google has released a solution for that
https://developers.google.com/mobile/articles/fast_buttons
This will allow visitor to interact with application native way. From Android 4 (as far as I remember) version by setting viewport meta tag the browser will automatically apply the fast click functionality.
For the animation issue always use Hardware accelerated animation with a fall back for older mobile browser. Using hardware accelerated animation it will make your application smooth as silk.
Follow this guideline and you can make your application as fast as gmail / youtube mobile version.
http://www.html5rocks.com/en/tutorials/speed/html5/
Best of luck.
Your webapp is consuming too much RAM. Don't use so many libraries and don't attach so many event handlers.

Will Web Development Frameworks replace Native IPhone Programming?

I need help clearing up some questions regarding these several third party dev-support frameworks (e.g. ViXML, Titanium Mobile) which promise iPhone app development at lightning speed using only Javascript and XML, without knowledge of Objective-C.
Questions
Are there any features possible on a regular Xcode development platform that are NOT possible for someone creating an app using these frameworks?
Is there any real savings in money and time when working with these platforms?
The approach to simplify development like this has been tried time and again, on many different platforms.
You always have the problem that the development framework will lack some features the "real" system has, and while sometimes a passthrough mechanism is offered it is invariably clunky.
Sometimes they do offer speed gains, but the degree to which they benefit you depends on the domain you are in - Unity is a great example of a framework that obviously saves people a ton of time developing games.
I personally think, that outside of gaming I don't think the benefit of using a third party framework to be really worthwhile. All of the best apps are ones that leverage the system to the fullest in terms of animation or UI abilities, meaning that someone spending some time crafting will be able to make a nicer looking app than someone who has to rely on the abilities of a framework.
The other problem you can run into is that no matter how popular a third party framework is, you are always going to have lots more support for the official platform - like the number of books around today on Objective-C and iPhone development, or even the very active Objective-C support on this very site.
The only exception would be if you had to have a cross-platform app and the app supported development for all the platforms you need. But even then I would argue for making the iPhone app distinct and take fullest advantage of the platform, or your app will languish and other competitors will overcome you.
Q1) Yea, performance. Javascript is slow on the iPhone, because the processor is slow. It's just a cold hard truth. Heck, loading NIBs vs using hand coded views is slow, because of the processing and loading involved, and that's simple compared to Javascript. Javascript is wonderful, but partly because we have really fast processors today. The iPhone (nor the Pre for that matter) have particularly fast processors, and Javascript's performance suffers because of it.
I have not used the frameworks, so can not comment on their productivity claims.
For question 1: non-native apps may not be able to access GPS information or other hardware on the phone.