Mobile Java
The Big Agenda JavaME Google Android RIM Blackberry
JavaME Agenda Java & JavaME JavaME Details  JVMs overview, KVM,  CLDC & MIDP JavaME Development SDKs & IDEs Emulators Testing JavaME Frameworks and Libs Proguard Antenna J2ME Polish JavaME issues and pit faults
Java Java editions JavaSE  JavaEE  JavaME Different target devices and systems
Java overview
Java ME Java Platform, Micro Edition , or  Java ME , is a Java platform designed for mobile  devices and embedded systems.  Target devices:  industrial controls mobile phones set-top boxes
PhoneME December 22th, 2008, JAVA ME source is  licensed as GPLv2. Implementation of CLDC and MIDP. Complete or partial implementation of optional packages (JSR) https:// phoneme.dev.java.net /
JavaME Components J2ME architecture is divided in to four different level KVM (Kilobyte Virtual Machine or custom implementation) Configurations (CDC, CLDC) Profiles (MIDP 1.0/2.0/2.1/3.0) Optional packages (JSR-XX)
JavaME How it works?
JavaME KVM Kilobyte Virtual Machine (KVM): compact, portable Java virtual machine specifically designed from the ground up for small, resource-constrained devices.  The high-level design goal for the KVM was to create the smallest possible “complete” Java virtual machine that would maintain all the central aspects of the Java programming language, but would run in a resource-constrained device with only a few hundred kilobytes total memory budget. More specifically, the KVM was designed to be: small, with a static memory footprint of the virtual machine core in the range of 40 kilobytes to 80 kilobytes (depending on compilation options and the target platform,) clean, well-commented, and highly portable, modular and customizable, as “complete” and “fast” as possible without sacrificing the other design goals.
JavaME KVM  Native Sun’s implementations of KVM for Windows, Solaris, Linux KVM has been successfully ported to more than 30 devices There are another implementations of KVM (Sony Ericsson – JP 5-8, Nokia J9) http :// java.sun.com / products / cldc / wp / KVMwp.pdf
JavaME KVM keywords KVM:  As the name implies, it is used for small program A subset of JVM A pool for running java code on the device
JavaME Configurations A  configuration  is a complete Java runtime environment, consisting of: Java virtual machine (VM) to execute Java bytecode  Native code to interface to the underlying system Set of core Java runtime classes (core classes, Input/Output,) basically used to classify myriad devices into a fixed configuration defines the Java language and virtual machine features and minimum class  libraries that a device manufacturer or a content  provider can expect to be available on all devices of the same category To use a configuration, a device must meet certain minimum requirements.
JavaME Configurations There are two different configurations Connected Device Configuration (CDC, set-top boxes, video-phones) Connected Limited Device Configuration (CLDC, cell phones, smartphones) CDC CLDC JavaSE
JavaME CDC & CLDC CDC Devices  2 MB or more total available memory Memory dedicated to J2ME environment More than 2MB ROM/Flash More than 512 KB RAM Network connectivity Full Java 2 Virtual Machine specification CLDC Devices: 160KB to 512KB total memory available for Java technology Limited power (battery), connectivity (often intermittent), UI (small screen) Features missing in  the CLDC VM: Floating point types  Object finalization JNI or reflection Thread groups or  daemon threads User Class loaders Change in classfile verification    preverification
JavaME Configuration keywords Configuration defines a basic, lowest-common-denominator J2ME runtime environment includes the virtual machine and a set of core classes derived primarily from J2SE  basically used to classify myriad devices into a fixed configuration
JavaME Profile The profile is layered on top of (and thus extends) a configuration.  Defines a standard Java platform for a vertical market device family, to ensure interoperability Profiles typically include class libraries that are far more domain-specific than the class libraries provided in a configuration.
JavaME Profiles There are many functionality supported by MIDP Graphical user interface Media Networking (high-level) Security
JavaME Profile defines Application life-cycle management (application installation, launching, deletion) User interface Event handling High-level application model (the interaction between the user and the application)
JavaME MIDlets MIDP application are known as  MIDlet MIDlets are executed by device-specific Application Secutirty Manager (ASM) ASM defines security restrictions for each MIDlet  ASM can interrupt MIDlet MIDlets move from state to state in the lifecycle
JavaME Simple Midlet import  javax.microedition.lcdui.Display; import  javax.microedition.lcdui.TextBox; import  javax.microedition.midlet.MIDlet; import  javax.microedition.midlet.MIDletStateChangeException; public   class  HelloWorldMidlet  extends  MIDlet { private  TextBox textBox; public  HelloWorldMidlet() { textBox =  new  TextBox("", "Hellw, World!", 20, 0); } protected   void  destroyApp( boolean  arg0)  throws  MIDletStateChangeException { notifyDestroyed(); } protected   void  pauseApp() { notifyPaused(); } protected   void  startApp()  throws  MIDletStateChangeException { Display. getDisplay ( this ).setCurrent(textBox); } }
SDKs & IDEs + CodeWarrior + Sun Studio One + JDE for Balckberry + Borland JBuilder MobileSet 2.0 + + IntelliJ IDEA + + + + + + + NetBeans + + + + + + + Eclipse Android   SDK Siemens SDK Motorola SDK Nokia SDK RIM Blackberry SDK SE SDK Sun SDK  
IDE IDEA is really powerful and agile IDE for software development.  IntelliJ IDEA provides integrated support for productive development of Java ME DoJa/MIDP/CLDC application development. Intelligent coding assistance, which recognizes wide variety of mobile SDKs (WTK, DoJa and more), with smart code completion and on-the-fly code analysis with syntax and error highlighting, plus instant quick-fixes and refactorings, unit testing and other developer-assisting features traditionally available for Java code, beefed up with run configurations with support for variety of mobile device emulators are tied together to help efficiently develop Java ME applications. Java ME module type allows to quickly set-up your application, with required mobile JDK, application resources, packaging options, build settings, etc. in a convenient manner.  Also IDEA provides  a couple of plug- in’s  for JavaME support.  A free, open-source Integrated Development  Environment for software developers. It contains all the tools that are need to create professional desktop, enterprise, web, and mobile applications with the Java language. NetBeans IDE have early access to the most of Sun Java features. Highly recommended by Sun.  Features of NetBeans IDE: Ability to interact with different emulators (JTWI support) MSA support Visual mobile designer  - GUI visual editor Wizards for component creation; SVG (Scalable Vector Graphics) components are embedded Creation of custom SVG  components Game builder support Multiple device configurations for project Access to web services Ant-based agile automated build system  Midlet signing, JMUnit support, certificate management, Proguard obfuscator integration Since version 6.7 NetBeans supports LWUIT library for UI building These J2ME wireless toolkits have been tested to work with EclipseME. (Others may work if they meet the UEI specification.): Sun Wireless Toolkits Motorola SDK for J2ME Nokia Developer Suite 2.2 for J2ME  Siemens SMTK for Series 60  Sony Ericsson J2ME SDK  Sprint PCS Wireless Toolkit for Java 2.0.13 MJT plug-in for development support (project creation, midlet creation, test creation) IntelliJ IDEA Net Beans Eclipse
SDKs Major vendors of mobile devices provide their own SDK in order to create  performance application with device(platform) specific features and nice  look&feel.  Vendor’s SDK usually includes following components: APIs: Bleutooth API (JSR-82) Location API (JSR-179) File Connection API(JSR-75) Scalable 2D Vector Graphics API (JSR-226) Mobile 3D Graphics API (JSR-184) Java Binding for the OpenGL ES API (JSR 239) XML API for Java ME (JSR 280) Specific Game API (Mascot, Capsule 3D Graphics) Platform-specific libraries Unit testing library (JMUnit, J2MEUnit) Device emulator (for one or series of devices) Profiler
Emulators
Emulators Virtual specification-related device 2 1 J2ME Wireless Toolkit 1.0.4  many (all version of SE Java Platform supported, all popular models supported) 1 1 Sony Ericsson J2ME SDK  Separate emulator for each series  1 1 Blackberry Java Development Environment 3.6  3410, 6310, 9200, 9210, 7210, 7650 1 1 Nokia General emulator  1 1 Motorola SDK v3.1.1 for J2ME  iXXX Series (emulators in according with models) 1 1 Motorola iXXX Emulator Phones CLDC MIDP Emulator
Testing Automated tools: TestQuest   m-Test IBM  Rational   RealTime  (using JUnit implementation) Unit Testing   : JMEUnit   JMUnit  (most popular) MOMEUnit Hammockmocks MockME
Frameworks & Libs JMUnit JMEUnit SonyEricsson Mobile Unit 1.0 MoMe Unit Hammockmocks MockMe OpenBaseMovil -db Perst   Lite  for J2ME OpenBaseMovil -core   FallME   Polish framework SpringME   Apime LWIUT KUIX Polish Fire-j2me Lwvcl Synclast UI API kUI Thinlet GUI Toolkit Pax JavaME GUI library TWUIK Testing frameworks Database and storage frameworks Application Model frameworks UI
ProGuard ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. ProGuard:   Creating more compact code, for smaller code archives, faster transfer across networks, faster loading, and smaller memory footprints. Making programs and libraries harder to reverse-engineer. Listing dead code, so it can be removed from the source code.
ProGuard usage Eclipse MTJ plug-in supports ProGuard integration ProGuard can be integrated in project by means of Ant   <taskdef resource=&quot;proguard/ant/task.properties&quot;  classpath=&quot;/usr/local/java/proguard/lib/proguard.jar&quot; />   Project may be obfuscated by ProGuard independently java -jar proguard.jar  options  ...
Antenna Antenna provides a set of  Ant  tasks suitable for developing wireless Java applications targeted at the MIDP.  Antenna helps to: c ompile preverify package obfuscate r un Preprocess The main feature of Antenna is to preprocess sources in order to create vendor-dependent build from vendor- independent codebase.
Antenna - How it works?
J2ME-Polish J2ME Polish is a suite of tools and technologies aimed at mobile developers and companies within the mobile space. Main features of J2ME Polish include: Lush :  A UI toolkit that is highly flexible and that can be designed outside of the application's source code. Janus :  A toolset for porting mobile application to different handsets and different technology platforms. Touch :  Technology for accessing server side content and communicating with remote parties. Trunk :  A persistence solution that allows you to load and save complex data with a single line of code. Marjory :  Our community maintained device database.
Polish can do what? J2ME Polish can be adjusted to support several platforms that support more than the normal MIDP profile.
Polish – How it works? Annotations in simple JavaME code
Polish – How it works? CSS styles for UI components in separate CSS file
Special Ant task Ant task Target device MIDlet class name
Annotations + CSS + Ant Task = ?
JavaME issues Poor native UI component palette RMS storage API is inconvenient Design issues (e.g. you can’t inherit your class from Layer)
JavaME pit faults Porting – app works on Nokia, but will not work on SE  Graphics – different screen’s size, different colors, different VGA Emulator – Looks fine on emulator, fails on device Midlet size – sometimes 128K is boundary size Bundled resources size Hard to test without real device
Android Agenda What is Android? Android features Dalvik VM Android market Android architecture Important APIs Android Development tools Android applications Inside of Android project Security model Android application building blocks Testing Simple application Android issues
What is Android? Android is a software stack for mobile devices that includes:  operating system (Linux kernel)  Middleware (Google-developed Java libraries) key applications (Media player, web browser) The  Android SDK  provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language.
Android features Handset layouts - VGA, 2D graphics library, 3D graphics library based on  OpenGL ES  1.0   SQLite as storage engine Connectivity  - GSM/EDGE, CDMA, EV-DO, UMTS, Bluetooth, and Wi-Fi   Messaging  – SMS/MMS/threaded text messaging Web browser  - WebKit application framewor Dalvik virtual machine Media support  - MPEG-4, H.264, MP3, AAC, MIDI, OGG, AMR, JPEG, PNG, GIF   Hardware support – cameras, touchscreens, GPS, accelerometers, and accelerated 3D graphics   Multi-touch  – native support Android market – Similar ot IPhone App Store
Dalvik virtual  machine Register based Dex file format Private byte code format No JIT Private VM per application / process. GC understands memory sharing semantics  Non-standard Java virtual machine.  Not Java SE  or  Java ME  No Swing/AWT windowing toolkits  Android’s programs are written in Java, using Java-oriented IDEs. It just doesn’t compile the java code into java bytecode but instead Dalvik bytecode (.dex) Every application has its own instance of the Dalvik virtual machine
Android Market Google’s application store, where users can search, download, buy and install software 27.10.2008 opened for developers to upload free software ($25 one time application fee)  Q1 2009 developers can distribute paid apps  Users can provide feedback to the developer and even rate the application  For developers: register, upload, and publish. The Android Market interface will provide developers with dashboard view of their account that will eventually include analytic data about how their apps are doing.
Android architecture
Android development tools Eclipse Android development tools (ADT plug-in) .  Provides convenient way to create and run Android projects. Other IDEs Android SDK
IDE for Android development The best is Eclipse IntelliJ IDEA Android plug-in NetBeans Android plug-in from Project Kenai
Android SDK contains Android emulator command line tools aapt  - Android asset packaging tool adb  - Android debug bridge aidl  - Android IDL compiler emulator  - Android emulator ddms  – Dalvik debug monitor  documentation example applications
Emulator limitations No support for placing or receiving actual phone calls No support for camera/video capture (input) No support for audio input No support for determining connected state No support for determining battery charge level No support for Bluetooth
Android applications An application is composed of one or more activities Every application is wrapped in a APK file. Application runs in separate Linux processes. Applications share code and data via Linux  Copy on Write semantics. Applications forks of a preinitialized Zygote process Shared memory is used for communication.
Security Model Each application runs as a separate Linux user. Security is enforced by OS and MMU, not VM. Applications asks for specific permissions during installation: android.permission.VIBRATE android.permission.CALL android.permission.DELETE_PACKAGES ...
Inside of Android project  Default properties of application Main application configuration file Source code folder Generated files, shouldn’t be changed manually Raw bytes data Bundled resources of application (icons, images)
Application building blocks AndroidManifest.xml Activities Views Layouts Intents & IntentReceivers Services Notifications (Broadcast recievers) ContentProviders
Manifest file describes components of the application — the activities, services, broadcast receivers, and content providers that the application is composed of names the classes that implement each of the components and publishes their capabilities (for example, which Intent messages they can handle) which permissions the application must have in order to access protected parts of the API and interact with other applications the permissions that others are required to have in order to interact with the application's components the minimum level of the Android API that the application requires   the libraries that the application must be linked against
Activity an activity is usually a single screen in our application however, activities can also be faceless one activity is designated as the entry point for your application activity from one application can be used by another application, in other words activities are reusable Have a state and can persist Can be foreground and background
Views The basic UI component Responsible for drawing and event handling Define your View through: Layout Resources (i.e. defined in  main.xml  file): <ListView    android:id=&quot;@+id/myListView&quot;   android:layout_width=&quot;fill_parent&quot;    android:layout_height=&quot;wrap_content&quot;  /> From your Activity class code: setContentView(R.layout.main); ListView myListView = (ListView)findViewById(R.id.myListView); Inside your code: ListView myListView = new ListView(this); setContentView(myTextView);
Layouts Layouts Specify the position of child views (controls) on the screen Common Layout Objects: FrameLayout : all child views are pinned to the top left corner of the screen LinearLayout : each child view is added in a straight line (vertically or horizontally)  TableLayout : add views using a grid of rows and columns RelativeLayout : add views relative to the position of other views or to its parent.  AbsoluteLayout : for each view you add, you specify the exact screen coordinate to display on the screen More info:  http:// code.google.com/android/devel/ui/layout.html
Intents Specify what intentions you have in terms of a specific action being performed Launch Activities Transition between the activities of your application Explicitly ( using  new Intent(current_application_context, new_activity_to_start); ):  Intent newIntent = new Intent(this, OtherActivity.class); startActivity(newIntent); //OtherActivity will become visible Implicitly ( using  new Intent(action_to_perform,data_to_perform_action_on); ): Intent newIntent = new Intent(Intent.ACTION_DIAL,   Uri.parse(“tel:12345”)); startActivity(newIntent);
Services Services run in the background  Primarily used for: Updating Content Providers Firing Intents Triggering Notifications Any operation that does not necessitate user interaction (i.e. networking, MP3 playback) For intensive and/or blocking operations, the service should be run in its own thread Creating and Controlling Services Create a Service: Extend the  Service  class; override specific methods (such as  onCreate ,  onStart ,  onBind , etc). Start and stop a Service: Use the  startService  method from inside your current  Activity  class Use the  stopService  method from inside your current  Activity  class
Testing Android SDK includes JUnit autoandroid (formerly known as Positron) – the mix of JUnit and Selenuim for Android
Simple Android application Source code Layout xml file
Android issues Android uses a Linux kernel, but, according to Google, it is not a Linux operating system. This specific nature makes it difficult to reuse existing Linux applications or libraries. Android does not use Java SE and ME. Android only reuses the Java language syntax, but does not provide the full-class libraries and APIs bundled with Java SE or ME. Android does not officially allow apps to be installed on, nor run from, an SD card.   Applications written in C and other languages can be compiled to ARM native code and run, but this development path is not officially supported by Google
Android pit faults Few real devices are available C yano MOD   vs. Android Google Libs for Google services
RIM Blackberry Agenda What is Blackberry? BES Blackberry development Capabilities Architecture SDK IDE Simulator App World Frameworks
What is Blackberry? BlackBerry  is a line of wireless handheld devices, which supports:  push e-mail mobile telephone text messaging internet faxing web browsing   multi-touch  Developed by the company Research In Motion
BES BlackBerry handhelds are integrated into an organization's e-mail system through a software package called &quot;BlackBerry Enterprise Server&quot; (BES).
BES – How it works?
Blackberry development
Blackberry capabilities  The BlackBerry smartphone is a pure Java device with all built-in applications and APIs written in Java BlackBerry supports: MIDP Standard APIs (MIDP v2.0 supported) for cross platform development CLDC Standard APIs (CLDC v1.1 supported) for connectivity BlackBerry specific Java APIs Java APIs for the BlackBerry solution enables you to develop rich custom client applications that provide: Customizable user interface Local data storage on the device  Event listening and system interfaces Secure wireless transport via HTTP Advanced Java API capabilities include: Integration with BlackBerry Email, PIM and Phone applications Almost always-on background threads to listen for push data Communication with Bluetooth®-enabled peripherals Location-based services and multimedia 2D Graphics , SVG support (Plazmic Media Engine) Full phone data access
Blackberry - Java BlackBerry devices are designed from the ground-up to run Java applications Native BlackBerry applications are written in Java All BlackBerry devices run the BlackBerry Java Virtual Machine (JVM) with full support for Java ME standard BlackBerry devices are software-upgradeable New versions of BlackBerry O/S and JVM can be loaded onto existing devices to provide new features and APIs BlackBerry exposes thousands of Java APIs Extensive Java ME JSR support Including Java Technology for the Wireless Industry (JTWI), Wireless Messaging, Mobile Media, Bluetooth, Location and Web Services  BlackBerry APIs that offer tighter integration with BlackBerry Smartphones
Blackberry Architecture
SDK Java Development Environment v 4.5 Additional component packs (4.6/4.7) Bundled Simulator in SDK
IDE Blackberry JDE (within SDK) Eclipse (JDE plug-in for Eclipse)
BlackBerry Java Development Environment (JDE) BlackBerry JDE used to build, test and optimize Java ME applications for BlackBerry It is free  Supports Java ME as well as many  BlackBerry APIs Includes a robust set of wireless debugging, profiling and optimization tools Secure code-signing infrastructure JDE Component Pack enables choice of Java-based IDE
Blackberry Simulator A lot of simulators Free http :// na.blackberry.com / eng / developers / resources / simulators.jsp
Application Signing Access to additional APIs for features, such as advanced cryptography, synchronization, and messaging, is restricted RIM Controlled APIs are split into 3 categories:  Runtime APIs BlackBerry Application APIs  BlackBerry Cryptography APIs   Signing of applications is not required to run applications using the BlackBerry Smartphone Simulator.   Sign services Sign service administrations fee is $20
Blackberry App World The BlackBerry App World™ storefront gives BlackBerry device users a single location to discover, purchase, download, manage, and rate items such as applications for BlackBerry devices   Similar to Apple App Store and Google Market
Frameworks J2ME-Polish (Blackberry Storm only for now) OpenBaseMovil (going to support)

Mobile Java

  • 1.
  • 2.
    The Big AgendaJavaME Google Android RIM Blackberry
  • 3.
    JavaME Agenda Java& JavaME JavaME Details JVMs overview, KVM, CLDC & MIDP JavaME Development SDKs & IDEs Emulators Testing JavaME Frameworks and Libs Proguard Antenna J2ME Polish JavaME issues and pit faults
  • 4.
    Java Java editionsJavaSE JavaEE JavaME Different target devices and systems
  • 5.
  • 6.
    Java ME JavaPlatform, Micro Edition , or Java ME , is a Java platform designed for mobile devices and embedded systems. Target devices: industrial controls mobile phones set-top boxes
  • 7.
    PhoneME December 22th,2008, JAVA ME source is licensed as GPLv2. Implementation of CLDC and MIDP. Complete or partial implementation of optional packages (JSR) https:// phoneme.dev.java.net /
  • 8.
    JavaME Components J2MEarchitecture is divided in to four different level KVM (Kilobyte Virtual Machine or custom implementation) Configurations (CDC, CLDC) Profiles (MIDP 1.0/2.0/2.1/3.0) Optional packages (JSR-XX)
  • 9.
  • 10.
    JavaME KVM KilobyteVirtual Machine (KVM): compact, portable Java virtual machine specifically designed from the ground up for small, resource-constrained devices. The high-level design goal for the KVM was to create the smallest possible “complete” Java virtual machine that would maintain all the central aspects of the Java programming language, but would run in a resource-constrained device with only a few hundred kilobytes total memory budget. More specifically, the KVM was designed to be: small, with a static memory footprint of the virtual machine core in the range of 40 kilobytes to 80 kilobytes (depending on compilation options and the target platform,) clean, well-commented, and highly portable, modular and customizable, as “complete” and “fast” as possible without sacrificing the other design goals.
  • 11.
    JavaME KVM Native Sun’s implementations of KVM for Windows, Solaris, Linux KVM has been successfully ported to more than 30 devices There are another implementations of KVM (Sony Ericsson – JP 5-8, Nokia J9) http :// java.sun.com / products / cldc / wp / KVMwp.pdf
  • 12.
    JavaME KVM keywordsKVM: As the name implies, it is used for small program A subset of JVM A pool for running java code on the device
  • 13.
    JavaME Configurations A configuration is a complete Java runtime environment, consisting of: Java virtual machine (VM) to execute Java bytecode Native code to interface to the underlying system Set of core Java runtime classes (core classes, Input/Output,) basically used to classify myriad devices into a fixed configuration defines the Java language and virtual machine features and minimum class libraries that a device manufacturer or a content provider can expect to be available on all devices of the same category To use a configuration, a device must meet certain minimum requirements.
  • 14.
    JavaME Configurations Thereare two different configurations Connected Device Configuration (CDC, set-top boxes, video-phones) Connected Limited Device Configuration (CLDC, cell phones, smartphones) CDC CLDC JavaSE
  • 15.
    JavaME CDC &CLDC CDC Devices 2 MB or more total available memory Memory dedicated to J2ME environment More than 2MB ROM/Flash More than 512 KB RAM Network connectivity Full Java 2 Virtual Machine specification CLDC Devices: 160KB to 512KB total memory available for Java technology Limited power (battery), connectivity (often intermittent), UI (small screen) Features missing in the CLDC VM: Floating point types Object finalization JNI or reflection Thread groups or daemon threads User Class loaders Change in classfile verification  preverification
  • 16.
    JavaME Configuration keywordsConfiguration defines a basic, lowest-common-denominator J2ME runtime environment includes the virtual machine and a set of core classes derived primarily from J2SE basically used to classify myriad devices into a fixed configuration
  • 17.
    JavaME Profile Theprofile is layered on top of (and thus extends) a configuration. Defines a standard Java platform for a vertical market device family, to ensure interoperability Profiles typically include class libraries that are far more domain-specific than the class libraries provided in a configuration.
  • 18.
    JavaME Profiles Thereare many functionality supported by MIDP Graphical user interface Media Networking (high-level) Security
  • 19.
    JavaME Profile definesApplication life-cycle management (application installation, launching, deletion) User interface Event handling High-level application model (the interaction between the user and the application)
  • 20.
    JavaME MIDlets MIDPapplication are known as MIDlet MIDlets are executed by device-specific Application Secutirty Manager (ASM) ASM defines security restrictions for each MIDlet ASM can interrupt MIDlet MIDlets move from state to state in the lifecycle
  • 21.
    JavaME Simple Midletimport javax.microedition.lcdui.Display; import javax.microedition.lcdui.TextBox; import javax.microedition.midlet.MIDlet; import javax.microedition.midlet.MIDletStateChangeException; public class HelloWorldMidlet extends MIDlet { private TextBox textBox; public HelloWorldMidlet() { textBox = new TextBox(&quot;&quot;, &quot;Hellw, World!&quot;, 20, 0); } protected void destroyApp( boolean arg0) throws MIDletStateChangeException { notifyDestroyed(); } protected void pauseApp() { notifyPaused(); } protected void startApp() throws MIDletStateChangeException { Display. getDisplay ( this ).setCurrent(textBox); } }
  • 22.
    SDKs & IDEs+ CodeWarrior + Sun Studio One + JDE for Balckberry + Borland JBuilder MobileSet 2.0 + + IntelliJ IDEA + + + + + + + NetBeans + + + + + + + Eclipse Android SDK Siemens SDK Motorola SDK Nokia SDK RIM Blackberry SDK SE SDK Sun SDK  
  • 23.
    IDE IDEA isreally powerful and agile IDE for software development. IntelliJ IDEA provides integrated support for productive development of Java ME DoJa/MIDP/CLDC application development. Intelligent coding assistance, which recognizes wide variety of mobile SDKs (WTK, DoJa and more), with smart code completion and on-the-fly code analysis with syntax and error highlighting, plus instant quick-fixes and refactorings, unit testing and other developer-assisting features traditionally available for Java code, beefed up with run configurations with support for variety of mobile device emulators are tied together to help efficiently develop Java ME applications. Java ME module type allows to quickly set-up your application, with required mobile JDK, application resources, packaging options, build settings, etc. in a convenient manner. Also IDEA provides a couple of plug- in’s for JavaME support. A free, open-source Integrated Development Environment for software developers. It contains all the tools that are need to create professional desktop, enterprise, web, and mobile applications with the Java language. NetBeans IDE have early access to the most of Sun Java features. Highly recommended by Sun. Features of NetBeans IDE: Ability to interact with different emulators (JTWI support) MSA support Visual mobile designer - GUI visual editor Wizards for component creation; SVG (Scalable Vector Graphics) components are embedded Creation of custom SVG components Game builder support Multiple device configurations for project Access to web services Ant-based agile automated build system Midlet signing, JMUnit support, certificate management, Proguard obfuscator integration Since version 6.7 NetBeans supports LWUIT library for UI building These J2ME wireless toolkits have been tested to work with EclipseME. (Others may work if they meet the UEI specification.): Sun Wireless Toolkits Motorola SDK for J2ME Nokia Developer Suite 2.2 for J2ME Siemens SMTK for Series 60 Sony Ericsson J2ME SDK Sprint PCS Wireless Toolkit for Java 2.0.13 MJT plug-in for development support (project creation, midlet creation, test creation) IntelliJ IDEA Net Beans Eclipse
  • 24.
    SDKs Major vendorsof mobile devices provide their own SDK in order to create performance application with device(platform) specific features and nice look&feel. Vendor’s SDK usually includes following components: APIs: Bleutooth API (JSR-82) Location API (JSR-179) File Connection API(JSR-75) Scalable 2D Vector Graphics API (JSR-226) Mobile 3D Graphics API (JSR-184) Java Binding for the OpenGL ES API (JSR 239) XML API for Java ME (JSR 280) Specific Game API (Mascot, Capsule 3D Graphics) Platform-specific libraries Unit testing library (JMUnit, J2MEUnit) Device emulator (for one or series of devices) Profiler
  • 25.
  • 26.
    Emulators Virtual specification-relateddevice 2 1 J2ME Wireless Toolkit 1.0.4 many (all version of SE Java Platform supported, all popular models supported) 1 1 Sony Ericsson J2ME SDK Separate emulator for each series 1 1 Blackberry Java Development Environment 3.6 3410, 6310, 9200, 9210, 7210, 7650 1 1 Nokia General emulator 1 1 Motorola SDK v3.1.1 for J2ME iXXX Series (emulators in according with models) 1 1 Motorola iXXX Emulator Phones CLDC MIDP Emulator
  • 27.
    Testing Automated tools:TestQuest m-Test IBM Rational RealTime (using JUnit implementation) Unit Testing : JMEUnit JMUnit (most popular) MOMEUnit Hammockmocks MockME
  • 28.
    Frameworks & LibsJMUnit JMEUnit SonyEricsson Mobile Unit 1.0 MoMe Unit Hammockmocks MockMe OpenBaseMovil -db Perst Lite for J2ME OpenBaseMovil -core FallME Polish framework SpringME Apime LWIUT KUIX Polish Fire-j2me Lwvcl Synclast UI API kUI Thinlet GUI Toolkit Pax JavaME GUI library TWUIK Testing frameworks Database and storage frameworks Application Model frameworks UI
  • 29.
    ProGuard ProGuard is afree Java class file shrinker, optimizer, obfuscator, and preverifier. ProGuard: Creating more compact code, for smaller code archives, faster transfer across networks, faster loading, and smaller memory footprints. Making programs and libraries harder to reverse-engineer. Listing dead code, so it can be removed from the source code.
  • 30.
    ProGuard usage EclipseMTJ plug-in supports ProGuard integration ProGuard can be integrated in project by means of Ant <taskdef resource=&quot;proguard/ant/task.properties&quot; classpath=&quot;/usr/local/java/proguard/lib/proguard.jar&quot; /> Project may be obfuscated by ProGuard independently java -jar proguard.jar  options  ...
  • 31.
    Antenna Antenna providesa set of  Ant  tasks suitable for developing wireless Java applications targeted at the MIDP. Antenna helps to: c ompile preverify package obfuscate r un Preprocess The main feature of Antenna is to preprocess sources in order to create vendor-dependent build from vendor- independent codebase.
  • 32.
    Antenna - Howit works?
  • 33.
    J2ME-Polish J2ME Polish isa suite of tools and technologies aimed at mobile developers and companies within the mobile space. Main features of J2ME Polish include: Lush :  A UI toolkit that is highly flexible and that can be designed outside of the application's source code. Janus :  A toolset for porting mobile application to different handsets and different technology platforms. Touch :  Technology for accessing server side content and communicating with remote parties. Trunk :  A persistence solution that allows you to load and save complex data with a single line of code. Marjory :  Our community maintained device database.
  • 34.
    Polish can dowhat? J2ME Polish can be adjusted to support several platforms that support more than the normal MIDP profile.
  • 35.
    Polish – Howit works? Annotations in simple JavaME code
  • 36.
    Polish – Howit works? CSS styles for UI components in separate CSS file
  • 37.
    Special Ant taskAnt task Target device MIDlet class name
  • 38.
    Annotations + CSS+ Ant Task = ?
  • 39.
    JavaME issues Poornative UI component palette RMS storage API is inconvenient Design issues (e.g. you can’t inherit your class from Layer)
  • 40.
    JavaME pit faultsPorting – app works on Nokia, but will not work on SE Graphics – different screen’s size, different colors, different VGA Emulator – Looks fine on emulator, fails on device Midlet size – sometimes 128K is boundary size Bundled resources size Hard to test without real device
  • 41.
    Android Agenda Whatis Android? Android features Dalvik VM Android market Android architecture Important APIs Android Development tools Android applications Inside of Android project Security model Android application building blocks Testing Simple application Android issues
  • 42.
    What is Android?Android is a software stack for mobile devices that includes: operating system (Linux kernel) Middleware (Google-developed Java libraries) key applications (Media player, web browser) The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language.
  • 43.
    Android features Handsetlayouts - VGA, 2D graphics library, 3D graphics library based on OpenGL ES 1.0 SQLite as storage engine Connectivity - GSM/EDGE, CDMA, EV-DO, UMTS, Bluetooth, and Wi-Fi Messaging – SMS/MMS/threaded text messaging Web browser - WebKit application framewor Dalvik virtual machine Media support - MPEG-4, H.264, MP3, AAC, MIDI, OGG, AMR, JPEG, PNG, GIF Hardware support – cameras, touchscreens, GPS, accelerometers, and accelerated 3D graphics Multi-touch – native support Android market – Similar ot IPhone App Store
  • 44.
    Dalvik virtual machine Register based Dex file format Private byte code format No JIT Private VM per application / process. GC understands memory sharing semantics Non-standard Java virtual machine. Not Java SE or Java ME No Swing/AWT windowing toolkits Android’s programs are written in Java, using Java-oriented IDEs. It just doesn’t compile the java code into java bytecode but instead Dalvik bytecode (.dex) Every application has its own instance of the Dalvik virtual machine
  • 45.
    Android Market Google’sapplication store, where users can search, download, buy and install software 27.10.2008 opened for developers to upload free software ($25 one time application fee) Q1 2009 developers can distribute paid apps Users can provide feedback to the developer and even rate the application For developers: register, upload, and publish. The Android Market interface will provide developers with dashboard view of their account that will eventually include analytic data about how their apps are doing.
  • 46.
  • 47.
    Android development toolsEclipse Android development tools (ADT plug-in) . Provides convenient way to create and run Android projects. Other IDEs Android SDK
  • 48.
    IDE for Androiddevelopment The best is Eclipse IntelliJ IDEA Android plug-in NetBeans Android plug-in from Project Kenai
  • 49.
    Android SDK containsAndroid emulator command line tools aapt - Android asset packaging tool adb - Android debug bridge aidl - Android IDL compiler emulator - Android emulator ddms – Dalvik debug monitor documentation example applications
  • 50.
    Emulator limitations Nosupport for placing or receiving actual phone calls No support for camera/video capture (input) No support for audio input No support for determining connected state No support for determining battery charge level No support for Bluetooth
  • 51.
    Android applications Anapplication is composed of one or more activities Every application is wrapped in a APK file. Application runs in separate Linux processes. Applications share code and data via Linux Copy on Write semantics. Applications forks of a preinitialized Zygote process Shared memory is used for communication.
  • 52.
    Security Model Eachapplication runs as a separate Linux user. Security is enforced by OS and MMU, not VM. Applications asks for specific permissions during installation: android.permission.VIBRATE android.permission.CALL android.permission.DELETE_PACKAGES ...
  • 53.
    Inside of Androidproject Default properties of application Main application configuration file Source code folder Generated files, shouldn’t be changed manually Raw bytes data Bundled resources of application (icons, images)
  • 54.
    Application building blocksAndroidManifest.xml Activities Views Layouts Intents & IntentReceivers Services Notifications (Broadcast recievers) ContentProviders
  • 55.
    Manifest file describescomponents of the application — the activities, services, broadcast receivers, and content providers that the application is composed of names the classes that implement each of the components and publishes their capabilities (for example, which Intent messages they can handle) which permissions the application must have in order to access protected parts of the API and interact with other applications the permissions that others are required to have in order to interact with the application's components the minimum level of the Android API that the application requires the libraries that the application must be linked against
  • 56.
    Activity an activityis usually a single screen in our application however, activities can also be faceless one activity is designated as the entry point for your application activity from one application can be used by another application, in other words activities are reusable Have a state and can persist Can be foreground and background
  • 57.
    Views The basicUI component Responsible for drawing and event handling Define your View through: Layout Resources (i.e. defined in main.xml file): <ListView android:id=&quot;@+id/myListView&quot; android:layout_width=&quot;fill_parent&quot; android:layout_height=&quot;wrap_content&quot; /> From your Activity class code: setContentView(R.layout.main); ListView myListView = (ListView)findViewById(R.id.myListView); Inside your code: ListView myListView = new ListView(this); setContentView(myTextView);
  • 58.
    Layouts Layouts Specifythe position of child views (controls) on the screen Common Layout Objects: FrameLayout : all child views are pinned to the top left corner of the screen LinearLayout : each child view is added in a straight line (vertically or horizontally) TableLayout : add views using a grid of rows and columns RelativeLayout : add views relative to the position of other views or to its parent. AbsoluteLayout : for each view you add, you specify the exact screen coordinate to display on the screen More info: http:// code.google.com/android/devel/ui/layout.html
  • 59.
    Intents Specify whatintentions you have in terms of a specific action being performed Launch Activities Transition between the activities of your application Explicitly ( using new Intent(current_application_context, new_activity_to_start); ): Intent newIntent = new Intent(this, OtherActivity.class); startActivity(newIntent); //OtherActivity will become visible Implicitly ( using new Intent(action_to_perform,data_to_perform_action_on); ): Intent newIntent = new Intent(Intent.ACTION_DIAL, Uri.parse(“tel:12345”)); startActivity(newIntent);
  • 60.
    Services Services runin the background Primarily used for: Updating Content Providers Firing Intents Triggering Notifications Any operation that does not necessitate user interaction (i.e. networking, MP3 playback) For intensive and/or blocking operations, the service should be run in its own thread Creating and Controlling Services Create a Service: Extend the Service class; override specific methods (such as onCreate , onStart , onBind , etc). Start and stop a Service: Use the startService method from inside your current Activity class Use the stopService method from inside your current Activity class
  • 61.
    Testing Android SDKincludes JUnit autoandroid (formerly known as Positron) – the mix of JUnit and Selenuim for Android
  • 62.
    Simple Android applicationSource code Layout xml file
  • 63.
    Android issues Androiduses a Linux kernel, but, according to Google, it is not a Linux operating system. This specific nature makes it difficult to reuse existing Linux applications or libraries. Android does not use Java SE and ME. Android only reuses the Java language syntax, but does not provide the full-class libraries and APIs bundled with Java SE or ME. Android does not officially allow apps to be installed on, nor run from, an SD card. Applications written in C and other languages can be compiled to ARM native code and run, but this development path is not officially supported by Google
  • 64.
    Android pit faultsFew real devices are available C yano MOD vs. Android Google Libs for Google services
  • 65.
    RIM Blackberry AgendaWhat is Blackberry? BES Blackberry development Capabilities Architecture SDK IDE Simulator App World Frameworks
  • 66.
    What is Blackberry?BlackBerry  is a line of wireless handheld devices, which supports:  push e-mail mobile telephone text messaging internet faxing web browsing   multi-touch  Developed by the company Research In Motion
  • 67.
    BES BlackBerry handheldsare integrated into an organization's e-mail system through a software package called &quot;BlackBerry Enterprise Server&quot; (BES).
  • 68.
    BES – Howit works?
  • 69.
  • 70.
    Blackberry capabilities The BlackBerry smartphone is a pure Java device with all built-in applications and APIs written in Java BlackBerry supports: MIDP Standard APIs (MIDP v2.0 supported) for cross platform development CLDC Standard APIs (CLDC v1.1 supported) for connectivity BlackBerry specific Java APIs Java APIs for the BlackBerry solution enables you to develop rich custom client applications that provide: Customizable user interface Local data storage on the device Event listening and system interfaces Secure wireless transport via HTTP Advanced Java API capabilities include: Integration with BlackBerry Email, PIM and Phone applications Almost always-on background threads to listen for push data Communication with Bluetooth®-enabled peripherals Location-based services and multimedia 2D Graphics , SVG support (Plazmic Media Engine) Full phone data access
  • 71.
    Blackberry - JavaBlackBerry devices are designed from the ground-up to run Java applications Native BlackBerry applications are written in Java All BlackBerry devices run the BlackBerry Java Virtual Machine (JVM) with full support for Java ME standard BlackBerry devices are software-upgradeable New versions of BlackBerry O/S and JVM can be loaded onto existing devices to provide new features and APIs BlackBerry exposes thousands of Java APIs Extensive Java ME JSR support Including Java Technology for the Wireless Industry (JTWI), Wireless Messaging, Mobile Media, Bluetooth, Location and Web Services BlackBerry APIs that offer tighter integration with BlackBerry Smartphones
  • 72.
  • 73.
    SDK Java DevelopmentEnvironment v 4.5 Additional component packs (4.6/4.7) Bundled Simulator in SDK
  • 74.
    IDE Blackberry JDE(within SDK) Eclipse (JDE plug-in for Eclipse)
  • 75.
    BlackBerry Java DevelopmentEnvironment (JDE) BlackBerry JDE used to build, test and optimize Java ME applications for BlackBerry It is free Supports Java ME as well as many BlackBerry APIs Includes a robust set of wireless debugging, profiling and optimization tools Secure code-signing infrastructure JDE Component Pack enables choice of Java-based IDE
  • 76.
    Blackberry Simulator Alot of simulators Free http :// na.blackberry.com / eng / developers / resources / simulators.jsp
  • 77.
    Application Signing Accessto additional APIs for features, such as advanced cryptography, synchronization, and messaging, is restricted RIM Controlled APIs are split into 3 categories: Runtime APIs BlackBerry Application APIs BlackBerry Cryptography APIs Signing of applications is not required to run applications using the BlackBerry Smartphone Simulator. Sign services Sign service administrations fee is $20
  • 78.
    Blackberry App WorldThe BlackBerry App World™ storefront gives BlackBerry device users a single location to discover, purchase, download, manage, and rate items such as applications for BlackBerry devices Similar to Apple App Store and Google Market
  • 79.
    Frameworks J2ME-Polish (BlackberryStorm only for now) OpenBaseMovil (going to support)

Editor's Notes

  • #5 Разве они J2* ? Слишком много слов! Используй меньше.
  • #11 1. Очень много текста !!!
  • #13 Нужно рассказать о других машинах. Рассказать о PhoneME Мало о KVM. Больше информации.
  • #15 Пояснить для каких устройств каждая конфигурация.
  • #16 1. Возможно объединить с предыдущим.
  • #20 Про профили явно информации недостаточно.
  • #54 ??? Надо?
  • #57 ???