Saturday, January 28, 2012

Mobile Application Development

“The search for common ground in a divided market”



In the beginning :
The first mobile phone in the history.
  • MOTOROLA DYNATAC 8000X

Early Smart Phones :

  • IBM Simon
  • Nokia 9000 Series




What is a smart phone?

  • Semi-Smart : phone that offers features beyond making calls like e-mail, taking pictures, play mp3, etc.
  • Phone that runs a complete operating system:
  1. Offers a standardized platform for development.
  2. Able to execute arbitrary 3rd party applications.
Quick facts :
  •  Today : 
  1. Cell phones in use today ~ 1.2 billion.
  2. Smartphones account for 14% ~ 170 million.
  • Projected 2012
  1. Cell phones ~ 1.7 billion.
  2. Smartphones 29% ~ 500 million.
  • 300% Smartphones growth in three years.
Mobile Development Solutions :
  • Java ME
  • Symbian
  1. UIQ
  2. S60
  • Android
  • Blackberry
  • OVI
  • Windows Mobile
  • iOS
  • LiMo
  • Ångström distribution
  • Adobe Flash Light
  • BREW
  • OpenMoko
  • Palm OS (Garnet OS, Cobalt OS)
  • Palm webOS (Mojo)
Why there are so many solution for Mobile Development?
  • Different Phones Different Uses
  1.  Phones for consumer or phone for business.
  2. V-Cast vs Palm
  • Money
  1. Hardware made money.
  2. Tried to maintain control over content and services.
  3. Wanted to charge 3rd party developers for the
    privilege of using their platform.
Common problem for The Mobile Application Developers is Abstraction :
  • Interface / GUI
  1. How does the developer create an interface.
  2. Different interaction techniques.
  3. Graphical capabilities of the phone.
  • Phone Services and Security
  1. What resources are available to your program.
  2. What types of boundaries or constraints are put on
    applications.
  3. How can code be considered “safe”.
Other issues they may face :
  • Distribution
  1. Centralized repository.
  2. Direct OTI.
  3. From PC.
  • Development
  1.  Language familiarity
  2. Debugging
  3. Emulation Vs on Phone
  4. Performance ( Very limited resources and battery )
There are three tiered solutions for Mobile Development
  • Virtual Environment
  1. Java ME
  2. BREW
  • Core Operating System
  1. Symbian
  2. LiMo
  • Rich Operating System : 
  1. Android
  2. iOS
 Now I am going to to talk about the Virtual Environments.
  • Java Platform :

  •  KVM / CLDC
The KVM / CLDC is specially designed mobile virtual machine. Original Ran with 128k Memory footprint. Paired down to bare bones like Reduced versions of classes of String, Object, Hashtable, Vector, Math, Simple Errors. Also The Yank out features are No long, float, double, Class Loaders, Threading and Multi dimensional arrays. But Each phone implementation can add them back. Notice that the KVM / CLDC takes a profile to complete the stack.

  • Mobile Information Device Profile
Mobile Information Device Profile adds libraries specific to Mobile phones like IO, Record management system, Basic media playback system. The LCDUI- 2D drawing library typically used for sprite based 2d games. And the Optional packages are SMS Control and PIM personal info management (Contact list control).

  • Java Micro Edition
Almost all phones include a runtime of  Pluggable Architecture. Java ME has attempted to be ubiquitous language for development. Its security model is relied heavily on digital signing. It also fells short of expectations like Phone specific plug-ins or Applications could be blocked without specific certificates and is currently paired down version of java 1.3. The New Version 3.0 just released and it offers support for several new features : GPS, New Graphics library LWUIT and Screen orientation. Also it's only available for windows with CLDC updated.

  • BINARY RUNTIME ENVIRONMENT FOR WIRELESS (BREW)
 It is developed by QUALCOMM and has V-Cast. The BREW is similar Java ME :
  1. C/C++ vs Java
  2. Smaller subset of phones
  3. Tighter integration then ME
You can start to finish development integration with high barrier to entry and number of large steps at high cost. Java ME can be as simple as publish and go.

Operating systems : Symbian
  • Symbian at a glance
Advantages :
- Huge Market Share 45%
- Robust and well vetted platform
- Very open
- Low overhead eventbased programming

Disadvantages :
- Strange flavor of C++ : Java and others with SDK
- Resource management is cumbersome
- Two popular SDK’s that are incompatible

UIQ VS S60 :
  • Rival SDK’s for the Symbian OS
  • UIQ
  1. Sony Ericsson
  2. Touch screen phones
S60 is developed and owned by Nokia and it is the current industry leader as it will become standard in late 2009. Note that both offer a full development stack.

S60 Development : The stack


S60 Development : IDE
  • Carbide.c++
  1. Developed by Nokia
  2. IDE based on Eclipse platform
  3. Provides a set of tools for debugging
  4. SDK independent
  • Carbide.vs
  1. Visual studio implementation
  2. Similar feature set
 S60 Development : Application Structure

All applications are treated as dll’s and have a single entry point and the main is Application Class.
It uses MVC style organization :
  1. M: Document Class
  2. V: Container / ContainerView Class
  3. C: AppUI Class
 S60 Development : Class And Variables




S60 Development : Active Objects




S60 Development : Error Handling
  • LEAVE and TRAP vs try/catch
  • Try Catch has large overhead
  • Use TRAP Macro
  • Cleanup is an issue :
Void Ctest::FooL()
{
CBar* v1= new (Eleave) Cbar;
CleanupStack::PushL(v1);
//Do dangerious things
EvilMethodL();
CleanupStack::PopAndDestroy();
};

    Tint Error :
    TRAP(error, fooL());{
    If(error!=KErrNon)
    {
    // Handel exception
    }

    S60 Development : Security Model
    • Data caging
    1. /Resource
    2. /Sys
    3. /Private
    4. /“Anything else”
    • Capabilities
    1. Open to all
    2. Granted by user at install
    3. Symbian Signed
    4. OEM
    S60 Development : Future

    On June 24, 2008 Nokia outright purchased the Symbian OS and Symbian Foundation Formed. Their goals are to “Provide a royalty-free open platform and accelerate innovation” and to combine Symbian OS, S60, UIQ and to move code base to open source in next two years.

     
     

    Operating Systems : iOS


    Numbers :
    • SDK Released March 6th 2008
    • Billion apps downloaded as of April 23rd
    1. Includes both pay and free
    2. Assuming 10% paid downloads
    3. lowest price of $.99/app
    4. $99 Million
    • 17% Market share just in front of Blackberry
    • Still well behind Symbian but growing very fast
    iPhone Development
    • Objective-C
    1. Message based architecture
    2. Similar to Smalltalk
    • No Java VM or other 3rd party plugins
    “An Application may not itself install or launch
    other executable code by any means, including
    without limitation through the use of a plug-in
    architecture, calling other frameworks, other
    APIs or otherwise. No interpreted code may be
    downloaded and used in an Application except for
    code that is interpreted and run by Apple’s
    Published APIs and built-in interpreter(s).”
    – iPhone SDK EULA

    iPhone Development: SDK



    • Four distinctive framework API’s
    1. Cocoa Touch Layer
    2. Media Layer
    3. Core Services Layer
    4. Core OS Layer
    • IDE
    1. Xcode
    2. Interface Builder
    3. iPhone Simulator
    4. On phone application development
    iPhone Development : Interface Builder / Xcode
    • Design for graphical, event-driven applications.
    • Pallet of GUI widgets to use in your views.
    • Drag and drop widgets onto views.
    • Links between objects can be created graphically.
    • Produces Nib Files.
     iPhone Development : Design Patterns

    Delegation don't subclass and method calls are messages [Object Message] and both are dynamic. The memory is managed that can auto-release.
    {
    NSString *string =[... Alloc]…;
    [string release];
    return string; //??
    }
    {
    NSString *string =[... Alloc]…;
    [string autorelease];
    return string;
    }
    iPhone Development : Application Life Cycle


    iPhone Development : Security Model

    Originally all applications ran as root. Not a whole lot better now because all apps run as “mobile” user. The iOS survived this year’s Pwn2Own google competition. Security based on delivery mechanism and all applications must be delivered through the iTunes App Store. Applications addition requires apple approval and testing it costs $99 for App Store and $299 for Enterprise and it is digitally signed by developer.

    iPhone Development : Future
    • In app purchases
    • Accessory APIs
    • Peer to Peer connectivity : New Game Kit
    • iPod library access
    • Embedded maps
    • Copy & Paste
    • Video
    Is it the year of Android?
    • Averaged 47% growth/month over first four months.
    • iPhone 88%
    • Currently only on HTC Dream(G1)
    • Really cool concept but will it penetrate the market.
    What is Android?

    It is a full stack of OS, Middleware, Applications and IDE. It is a fully open source OS. Android gives the user the full control of their devices and can establish preferred applications. Application Modularity provide functionality that can be used by others.

    Android Development : The Stack


    Android Development : JVM

    • Dalvik
    - Register-based Java virtual machine.
    - Runs .dex files.
    - Similar to a JAR.
    - Used a cross compiler tool ‘dx’
    - Optimized for multiple instances.
    • Why not Java ME?
    - Not fully open source.
    - Still under control of Sun Micro.
    - Veto on any proposed changes.

    Android Development : Application Overview
    • Packaged in one .apk file
    • Each application lives in its “own phone”
    - Its own Linux process.
    - Its own JVM.
    - Its own “file system”
    • Component based architecture :
    1. Activities
    2. Services
    3. Broadcast receivers
    4. Content providers
    • Manifest file provides information about components.
    Android Development : Activities

    A visual interface for one task a user will attempt. Each activity gets a window to draw in. Similar to a controller, takes view objects to display in the window. Views can nest within each other. Application can designate one activity as first.

    Android Development : Services

    Background process that is not UI ex. Media Player. It can connect (bind) to a service that currently running or by starting it. Once bound can communicate through predefined interface. You start, stop, etc the Media Player.

    Android Development : Broadcast Receivers / Content Providers
    • Broadcast Receivers
    1. Event listeners ( No UI ) 
    2. Can broadcast events
    3. On event execute activity or display notification
    • Content Providers
    1. Opens specific part of an applications data
    2. Uses Content Resolvers
    Androids Development : Intents
    • Contains the target object, the target method, and a URI of data to act on
    • Activates components ( Aside from content providers )
    • Intent can call startActivity, startService, sendBroadcast
     Android Development : Application Life Cycle 


    Android Development : Demo



      That's all folks,
      Thanks for reading.
      Related Posts Plugin for WordPress, Blogger...