31
May 13 th , 2008 Seminar on Small and Mobile Devices Dejan Juric ([email protected]) 1 Java Micro Edition Platform Android Seminar on Small and Mobile Devices May 13 th , 2008 Dejan Juric ([email protected])

Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

  • Upload
    juricde

  • View
    106

  • Download
    0

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 1

Java Micro Edition Platform& 

Android

Seminar on Small and Mobile DevicesMay 13th, 2008

Dejan Juric ([email protected])

Page 2: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 2

Outline

● Motivation & Goal● Java Micro Edition Platform● Android● Java ME vs Android● Conclusion & Discussion

Page 3: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 3

Motivation

● Number of mobile phone subscribers by November 2007: 3.3 billion. (personal computers: 1 billion)

● Problems with mobile devices:– Heterogeneous: different form factors, features, 

functions– Resource­constrained

Page 4: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 4

Goal

● Allow customization of devices– Download new services and applications from the 

Internet

● Development of applications and services– Device­independent– Cost efficient

Page 5: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 5

Java Micro Edition Platform

● Available on most current mobile phones● Subset of the Java Platform 

– for resource­constrained devices

Java SE

Java ME

Page 6: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 6

Java Platforms

Page 7: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 7

Java Micro Edition ­ Overview

Configurations

Profiles

Page 8: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 8

Java ME ­ Configurations

● Configuration: complete Java runtime environment– Defines the minimum 

set of Java virtual machine features & class libraries

Page 9: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 9

Java ME – Configurations ­ CDC

● Connected Device Configuration– 32bit CPU, 2MB of 

RAM, 2 MB of ROM– Modified Java SE core 

class libraries– CDC 1.1 matches JDK 

1.4 APIs

Page 10: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 10

Java ME – Configurations ­ CLDC

● Connected Limited Device Configuration– At least 160 kB of 

non­volatile memory– At least 32 kB of 

volatile memory– Minimal host 

operating system or kernel available 

CLDC 1.1java.lang

+java.lang.refjava.iojava.util

javax.microedition.io

Page 11: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 11

Java ME – CLDC

● Eliminated features– User­defined class loaders– Thread groups and daemon threads– Finalization of class instances– Asynchronous exceptions– Floating point types (since CLDC 1.1)

● Class file verification– Off­device preverification and runtime verification

Page 12: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 12

Java ME ­ Profiles

● Define a minimum set of APIs available on a “family” of devices

● Applications are written for a particular profile– Portable across 

devices that support that profile

Page 13: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 13

Java ME ­ MIDP

● Mobile Information Device Profile– Screen of at least 96x54 pixels– Keypad, keyboard or touchscreen input– 256 KB of nonvolatile memory – 128 KB of RAM– 8 KB of nonvolatile writable memory for persistent 

data– Two­way network connection

Page 14: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 14

Java ME ­ MIDP

CLDC 1.1 MIDP 2.0java.lang javax.microedition.lcdui

+java.lang.ref +javax.microedition.lcdui.gamejava.io +javax.microedition.mediajava.util +javax.microedition.media.control

javax.microedition.io javax.microedition.midlet+javax.microedition.pkijavax.microedition.rms

● Mobile Information Device Profile – Building Blocks

Page 15: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 15

Java ME – Development Process

Java Source

Java Class Files

Preverified Class Files

Preverification

JAR Package

Packaging

Application on Device

Deployment

Compile

Page 16: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 16

Java ME – Development Tools

● Wireless toolkits:– Sun Wireless Toolkits– Motorola SDK for J2ME™– Sony Ericsson J2ME SDK

● Development Environments– EclipseME– Netbeans Mobility

Page 17: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 17

Java ME – MIDlet Demo

// Exceptions omitted for claritypublic class TestMIDlet extends MIDlet implements CommandListener {

private Form mMainForm;public TestMIDlet() {

mMainForm = new Form("TestMIDlet");mMainForm.append(new StringItem(null, "Hello, MIDP!"));mMainForm.addCommand(new Command("Exit", Command.EXIT, 0));mMainForm.setCommandListener(this);

}protected void destroyApp(boolean arg0)  {}protected void pauseApp() {}protected void startApp() {

Display.getDisplay(this).setCurrent(mMainForm);}public void commandAction(Command arg0, Displayable arg1) {

notifyDestroyed();}

}

Page 18: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 18

Java Micro Edition

● Questions?

Page 19: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 19

Android

● Software platform and operating system for mobile devices based on the Linux operating system

● Developed by Google and the Open Handset Alliance

Page 20: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 20

Android ­ Open Handset Alliance

● Vision: “... accelerate innovation in mobile and offer consumers a richer, less expensive, and better mobile experience.”

● Members (more than 30):– Google, HTC, NTT DoCoMo, China Mobile, T­

Mobile, Motorola, Samsung, Intel ...– Swiss members: Esmertec, Noser

Page 21: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 21

Android ­ Architecture

Page 22: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 22

Android ­ Runtime

● Dalvik: It's not a Java virtual machine● Every Android application runs in its own 

process within its own instance of the Dalvik VM.

Java Source Java Class Files

Dalvik ExecutableFiles (.dex)

javac

dx

Page 23: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 23

Android – Application Framework

● Views: User Interface● Content Providers: Access & share data● Resource Manager: non­code resources 

(graphics, external strings ...)● Notification Manager: custom alerts in status 

bar● Activity Manager: Manages life cycle of 

applications

Page 24: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 24

Android – Activity & Intent

● Activity: single, focused thing that the user can do

● Intent: abstract description of an operation to be performed

Page 25: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 25

Android – Life cycle ­ Activity

● Activity can be killed! ● We have to store the 

state

Page 26: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 26

Android ­ Development

● Software Development Kit:– Eclipse Plugin– Command line tools

● Dalvik Debug Monitor Service (ddms)● Android Debug Bridge (adb)● Android Asset Packaging Tool (aapt)● Android Interface Description Language (aidl)

– Emulator

Page 27: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 27

Android ­ Demo

● Demonstration with SDK and emulator

Page 28: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 28

JavaME vs Android – Developer's Perspective

● Java ME

+ Security model

+ Works on many devices

­ On mobile phones: Integration into system not seamless

­ Too many APIs

● Android

+ Security model

+ Optimized for smartphones

+ Seamless integration into system

­ API: more complicated than Java ME

Page 29: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 29

Java ME vs. Android ­ General

● Java ME

+ Lots of devices already available

­ Fully controlled by Sun (Licensing!)

­ Formal specification process (slow)

● Android

+ Opensource

+ Defines unique software stack for mobile devices

­ No devices available

­ No standards are used (e.g. VM, IDL ...)

Page 30: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 30

Conclusions

● Rapid growth in the mobile market expected● Wireless devices getting more powerful

– More features– Better connectivity

● Both technologies could play a big role in the future

Page 31: Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices

May 13th, 2008 Seminar on Small and Mobile DevicesDejan Juric ([email protected]) 31

Discussion

● Questions?