Archive | Uncategorized RSS for this section

Web or Native?

credits: http://monolithinteractive.com/2011/02/04/web-or-native/

For mobile developers, whether to build a native or web application is an important decision. The choice must be made wisely as it impacts the user’s entire application experience. Until recently, the decision was usually clear-cut: native apps are faster, better looking, and can use more device features, web apps are simpler and can run on multiple platforms. But web apps are closing the gap in the look and feel, speed, and even access to device hardware features, like GPS data. Even so, there are still some cases when a native app is the way to go.

 

A native application runs on the operating system for which it was developed. On the iPhone, native applications are written in Objective C and run on iOS, Apple’s mobile operating system. This means that the app, and any updates, must be installed by the user via Apple’s App Store distribution and approval process. Native applications have the advantage of access to hardware features, such as the camera, accelerometer, and compass. In addition, software development kit (SDK) frameworks give developers access to iPhone resources, including contacts, calendar events, and photos. Native applications also allow the developers to design richer user experiences.

The pitfall to native applications is that they are single platform. Such applications are designed with a single platform in mind and are not easily portable to other platforms. It can be nearly as much work to port an iPhone app to run on an Android device as it was to develop the iPhone app.
For a variety of circumstances, developing a native application is the best choice. For instance, if the application is complex in that it contains many screens or steps, such as a game or complex animation, building a native application would be wise. Native apps are also best when lots of data must be stored on the phone or when speed is a priority. Applications which require use of most hardware features, for example knowing how the device is tilted, must use native apps as such information cannot be attained through a web application.

 

Web applications, of course, run on web browsers. They are written in HTML+CSS and JavaScript. Web apps fill certain needs of developers that native applications cannot. One of the biggest benefits of web applications is that they are multi-platform. These apps can run on iOS as well as Android, Symbian, etc. JavaScript, however, may not be interpreted in the same manner by some browsers and in some cases, may not be interpreted at all. In these situations, porting efforts may be required. Another benefit of web apps is that they do not require installation. Any user interaction with Apple’s App Store is unnecessary, although, the option of packaging the application for distribution by the App Store is available.
If you considered a web app even 6 months ago, take another look at what can be achieved. New frameworks have made web app an option for apps that would have needed to be native not long ago.

 

There are new web app features, mostly from HTML5, that aren’t commonly known:

  • Web apps can be cached on the iPhone for offline use when a wifi or 3G connection is not available.
  • They can also store local data, even a client-side database on the mobile device.
  • Hardware access is slowly being opened up. On the iPhone, web apps can get the user’s current location from the GPS.
  • New Javascript frameworks make it easy to create near-native UI for web apps. Sencha Touch aids in building applications for iOS and Android phones and tablets. It offers design of a rich user experience, but is more difficult to learn than some simpler JavaScript frameworks such as jQTouch. jQTouch is the better option when emphasis is on the development of web content.
  • Users can install a web app, adding it to their home screen with an icon and splash screens just like a native app.

Example of Sencha Touch: Kiva.org
There is a third option that allows developers to write apps with web technologies but get access to device hardware, device data, and App Store distribution: Hybrid Apps.

 

Combining web and native applications relieves some of the drawbacks of each type of app. This is done by “wrapping” the web app with a native app to gain access to more native features, such as some hardware features and iPhone resources (GPS position change, accelerometer, camera, audio playback and capture, etc). Like native apps, these applications must be distributed throughthe App Store, making them easier to find and monetize. PhoneGap is the leading framework for hybridization, with wrappers for multiple platforms, so the same core web app can be turned into a native iPhone, Android, BlackBerry, WebOS, or Symbian app.

 

The strengths and weaknesses of each approach mean each one is the best choice for some applications.

 

Use of web applications is the simpler option and more advantageous in certain situations. When hardware features are not required, except for, perhaps, a simple GPS, and only small amounts of on-phone data is required, using a web app is best. Similarly, when speed is not crucial, but portability between platforms is, use of web applications is the better choice.

 

If you want to design a deep, complex user experience, possibly for a game, want to use Apple’s high-level APIs, like developing with C-style languages, or need killer performance, go with a native app. If you want to work with well documented frameworks with lots of example code, for now, native apps are the best option. You’ll have to deal with memory management, pointers, and lots of delegate pattern use, the learning curve can be steep depending on your background.

 

If you want to share a codebase between devices or really prefer writing web apps but want to use App Store distribution or device hardware that isn’t normally available to web apps, a hybrid app fits your needs. If you’re used to writing web apps and want to put together a pretty standard app that needs to look like native UI, a hybrid app might save you a lot of time over learning Objective C.

PhoneGap 1.4 wrapping Sencha Touch 2.X – What about performance?

This question, asked on stackoverflow.com, is really interesting and covers an important area in cross-platform mobile development: performance optimization

Question:

I’m building a multiplatform tablet app wrapping it with Phonegap 1.4 using just its webview, then I work my magic with the Sencha Touch 2 framework. By multiplatform I mean iOS 5.X+ and Android 3.0+ (for now).

This app is working great so far, all its features work on both systems but… On the Android tablet (Samsung GalaxyTab) its really slow. What’s happening? Can I do something about it, or its just android’s limit?

Thanks

Answer:

I’ve tested many of my Sencha Touch 2 applications on Samsung GalaxyTab and the performance is really terrible. There’s a fact (which maybe a part of actual reason) that, iOS does many pre-process and calculation before rendering to make it seems smoother to user’s look and feel, while Android tends to render & process simultaneously on the go.

In general, it could be say that, to every cross-platform mobile apps built on Javascript, like Sencha Touch, iOS performance is significantly better than Android. However, Sencha Touch dev team is trying their best to improve this, hopefully it would be better in next releases. You could see this article about iOS & Android devices performance comparison.

http://www.sencha.com/blog/sencha-touch-2-developer-preview/

PS: While it’s much relevant to the OS’s limit, you can also optimize your app to make it perform better on Android devices. To my experience, the best practice is:

Do NOT use CSS3 too much.
Keep your DOM as minimal as possible.

For more details, you can refer to this topic on stackoverflow.com:

http://stackoverflow.com/questions/10085637/phonegap-1-4-wrapping-sencha-touch-2-x-what-about-performance/10085756#10085756

Stack Overflow – Q&A for professional and enthusiast programmers

Author: Thiem Nguyen

Society always thinks IT engineers as “Mr.Know Everything” in Computer usage. But there is a funny fact that I could make sure at 100% that we are who “Googling” the web most, for our daily common tasks: how to implement something, address and fix bugs, or just simply as all the others: how to fix our computer!

Programming is something like playing online games. The more you play, the more experience you will get. Becoming a master in game is just like a guru in programming. Master often helps other, and so do gurus. Experienced programmers always tend to share their knowledge to newbie, even with no rewards (say money, for example) in turn. Stack Overflow is an ideal place to show a statement which is my eternal belief: Programmers are kindest people in the world!

The first time when I posted a question about regular expression, a guru (I guessed so because his reputation score was so scary) answered very nicely, comprehensively, and completely. It’s hard to believe that a strange people gives you a very detailed answer as if he’s your best friend, right? Since then I’ve started falling in love with this site.

After 2 months answering and being answered on this site, I feel like I’m a different person.

Let’s start learn more about it and I’m quite sure you will love it, too!

http://stackoverflow.com/about

NoSQL database

http://www.mongodb.org/

Agile and Scalable

MongoDB (from “humongous”) is a scalable, high-performance, open source NoSQL database. Written in C++, MongoDB features:

Hiện thông báo đơn giản

The Developer's Info

We moved. Please visit this link for this post.

 

 

 

Toast is very good solution when need to notify user about something.

For example I always show Toast to the user when it wants to open SDCard which is not mounted (best practice).

I am going to show simple Toast which shows on the center of activity.

View original post 137 more words

Ví dụ đơn giản về Regular Ex

Rob Bamforth's Blog

How to check for a valid email address string.

Example Code:

String email = “test@test.com”;
Pattern p = Pattern.compile(“.+@.+\\.[a-z]+”);
Matcher m = p.matcher(email);
boolean matchFound = m.matches();

if(matchFound){
System.out.println(“EMAIL OK”);
}else{
System.out.println(“EMAIL ERROR”);
}

View original post

Tạo activity dạng một form động cho app – Android Code

M Moniruzzaman's Blog

You can implement application styles as you like in android platform. If you want to create a transparent background Activity then follow the steps below.

Transparency of background:

  1. create an activity
  2. set activity’s theme as “@android:style/Theme.Translucent” in AndroidManifest.xml
  3. that’s all

If it is needed to have a UI with semi-transparent background, and to define opacity then use this technique with Theme.Translucent. If you set the color of the UI layout as #29000000, the first hex 2-digit(#29) represents alpha channels of color and set opacity. If value is 00 that means 100% transparent. if value is set FF it will be opaque, it can be any value in 00 to FF.

Opaqueness of background / Opacity:

  1. create an activity
  2. set activity’s theme as “@android:style/Theme.Translucent” in AndroidManifest.xml
  3. declare opaque_back a color with setting alpha value such as #29000000(blackish), in/res/colors.xml
  4. set…

View original post 25 more words