Martin l bger it konsulent martin lobger@hiq dk l.jpg
This presentation is the property of its rightful owner.
Sponsored Links
1 / 21

Martin Løbger – IT Konsulent [email protected] PowerPoint PPT Presentation


  • 184 Views
  • Uploaded on
  • Presentation posted in: General

Martin Løbger – IT Konsulent [email protected] Rich vs. Reach. En introduktion til J2ME/JavaME. The Chasm. Reach Rich J2MEiPhone Android Symbian Windows Mobile. Konsulentens svære valg. Reach. ...er ikke så svært. Rich. Symbian. Eget af Nokia

Download Presentation

Martin Løbger – IT Konsulent [email protected]

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Martin l bger it konsulent martin lobger@hiq dk l.jpg

Martin Løbger – IT Konsulent

[email protected]


Rich vs reach l.jpg

Rich vs. Reach

En introduktion til J2ME/JavaME


The chasm l.jpg

The Chasm

Reach Rich

J2MEiPhone Android

Symbian Windows Mobile


Konsulentens sv re valg l.jpg

Konsulentens svære valg

Reach

  • ...er ikke så svært

Rich


Symbian l.jpg

Symbian

  • Eget af Nokia

  • På vej mod Open Source

  • Forum Nokia

  • Carbide.c++ C/C++ IDE

    • Baserete på Eclipse 3.3 + plugins


Symbian os api og c kode stilen l.jpg

Symbian OS API og C++ kode stilen

static const char hellorom[] = “hello”;

_LIT(KHelloROM, "hello");

const char *helloptr = hellorom;

TPtrC helloPtr(KHelloROM);

http://www.forum.nokia.com/Resources_and_Information/Explore/Runtime_Platforms/Symbian_C++/Code_and_Examples.xhtml


Slide7 l.jpg

Java

  • Udviklet af SUN Microsystems

  • Fortolket sprog

  • Bytekode

  • Pakket i JAR filer (zip format)

  • Obfuscating

  • Magic token: CAFEBABE


Slide8 l.jpg

J2ME


Midp jsr 118 l.jpg

MIDP – JSR 118

  • javax.microedition.io

  • javax.microedition.lcdui

  • javax.microedition.lcdui.game

  • javax.microedition.media

  • javax.microedition.media.control

  • javax.microedition.midlet

  • javax.microedition.pki

  • javax.microedition.rms


Den langt fra komplette jsr liste l.jpg

Den (langt fra) komplette JSR liste

  • JSR 75 File connection v1.0 and PIM v1.0 APIs

  • JSR 82 APIs for Bluetooth v1.1

  • JSR 118 MIDP v2.1

  • JSR 120 Wireless Messaging API 1.1

  • JSR 135 Mobile Media API 1.1 (audio and video play, audio capture only; does not support video capture, camera control, or FM radio)

  • JSR 139 Connected Limited Device Configuration (CLDC) 1.1

  • JSR 172 JAX-XML Web Services API (XML parsing) and JAX-RPC API

  • JSR 177 Security and Trust Services APIs SATSA-APDU and SATSA-CRYPTO

  • JSR 179 Location API 1.0

  • JSR 184 Mobile Graphics API 1.1

  • JSR 205 Wireless Messaging API 2.0

  • JSR 211 Content Handler API 1.0

  • JSR 226 Scalable 2D Vector Graphics API 1.0

  • JSR 234 Advanced Multimedia Supplements (3D Audio & Music, Audio mixing, including audio progressive upload and video progressive playback) 1.1

  • JSR 248 Mobile Service Architecture Subset API 1.0

  • Nokia UI API 1.1a


Kom godt igang l.jpg

Kom godt igang

  • NetBeans

  • Eclipse Mobile Tools for Java (http://www.eclipse.org/dsdp/mtj)

    • Tidligere kendt som EclipseME (http://eclipseme.org)

  • SDK

    • SUN Java Platform Micro Edition SDK 3.0

      http://java.sun.com/javame/downloads/sdk30.jsp

    • Nokia S40

      http://www.forum.nokia.com/Resources_and_Information/Tools/Platforms/Series_40_Platform_SDKs

    • Sony Ericsson

      http://developer.sonyericsson.com/site/global/docstools/java/p_java.jsp

    • LG

      http://developer.lgmobile.com/lge.mdn.tnd.RetrieveTNDInfo.laf

    • Blackberry

    • Skype/Amoi

    • Windows Mobile


Java n sten som vi kender det l.jpg

Java – næsten som vi kender det

J2SE

J2ME

import javax.microedition.midlet.MIDlet;

publicclass Hello extends MIDlet {

publicvoid startApp() {

System.out.println("Hello, World!");

}

}

publicclass Hello {

publicstaticvoid main(String[] args) {

System.out.println("Hello, World!");

}

}


Hello world l.jpg

Hello World

Demo


Slide14 l.jpg

/**

* Tries to retrieve the IMEI number of the phone. Not all platforms

* supports this feature.

*

* @return The IMEI number or "na" if the platform does not support this

* feature.

*/

protected String getIMEI() {

String[] imeiProperties = {

// Generic

"IMEI", "phone.imei", "device.imei", "com.imei",

// Nokia specific

"com.nokia.IMEI", "com.nokia.mid.imei",

// Sony Ericsson specific

"com.sonyericsson.imei",

// Motorola specific

"com.motorola.IMEI",

// Samsung specific

"com.samsung.imei",

// Siemens specific

"com.siemens.imei"

};

for (int i = 0; i < imeiProperties.length; i++) {

try {

if (System.getProperty("microedition.platform").startsWith("Nokia6280")) {

continue;

}

String imei = System.getProperty(imeiProperties[i]);

if (imei != null) {

return imei;

}

}

catch (Exception e) {

}

}

return "na";

}


Slide15 l.jpg

/**

* Tries to retrieve the IMEI number of the phone. Not all platforms

* supports this feature.

*

* @return The IMEI number or "na" if the platform does not support this

* feature.

*/

protected String getIMEI() {

String[] imeiProperties = {

// Generic

"IMEI", "phone.imei", "device.imei", "com.imei",

// Nokia specific

"com.nokia.IMEI", "com.nokia.mid.imei",

// Sony Ericsson specific

"com.sonyericsson.imei",

// Motorola specific

"com.motorola.IMEI",

// Samsung specific

"com.samsung.imei",

// Siemens specific

"com.siemens.imei"

};

for (int i = 0; i < imeiProperties.length; i++) {

try {

if (System.getProperty("microedition.platform").startsWith("Nokia6280")) {

continue;

}

String imei = System.getProperty(imeiProperties[i]);

if (imei != null) {

return imei;

}

}

catch (Exception e) {

}

}

return "na";

}


Slide16 l.jpg

byte data[] = null;

HttpConnection connection = (HttpConnection)Connector.open(“http://hiq.dk/login.apsx”, Connector.READ_WRITE);

try {

if (postData != null) {

connection.setRequestMethod(HttpConnection.POST);

connection.setRequestProperty("Content-Type", "text/xml; charset=utf-8");

OutputStreamos = connection.openOutputStream();

try {

os.write(postData.getBytes());

// os.flush(); //Including this line may produce undesired results on certain devices

/*

* If you call os.flush(), some devices will send the

* request in HTTP 1.1 "chunked" encoding by adding a

* "Transfer-encoding: chunked" header to the request

* and writing the size of each block of data in

* hexadecimal form as a text line before the data bytes

* themselves. This is repeated for any number of blocks

* you send, usually demarcated by calls to flush(). If

* you have a HTTP 1.1-compliant Web server this should

* be transparent to your server side scripts, but if

* you do not, you will either want to avoid calling

* flush() (though some devices may still chunk for you

* automatically) or write some HTTP 1.1 chunk handling

* code in your server scripts. All you will need to do

* in the latter case is read the first text line of the

* response, extract the size from it (i.e. "C\r\n"

* where C means 12 bytes of chunk follow), and then

* read 12 bytes of response data. Then read another

* line to see if there is another chunk size, and

* repeat until stream is closed or your script has all

* the data it needs. See the HTTP 1.1 specification for

* more details.

*/

}

finally {

os.close();

}

}


Test test test l.jpg

Test, test & test

  • Modning

  • Fysiske devices

    • Alle producenter

    • Bredt udsnit af modeller (eks. Nokia S40 + S60)

    • Skærmstørrelser

    • JSR features


Remote device access services http apu ndhub net l.jpg

Remote Device Access Serviceshttp://apu.ndhub.net/


Deploying l.jpg

Deploying

  • Bluetooth

  • MMS

  • Web Server

    • Mimetypes

      • .jarapplication/java-archive

      • .jadtext/vnd.sun.j2me.app-descriptor


Jad jar l.jpg

JAD & JAR

JAD – Java Descriptor

JAR – Java Archive

Zip fil

.class filer

Manifest

Resources (read only)

MIDlet-1: Main,,dk.hiq.helloworld.Main

MIDlet-Jar-URL: [webserver]/HelloWorld.jar

MIDlet-Name: PanicWorld MIDlet Suite

MIDlet-Vendor: MIDlet Suite Vendor

MIDlet-Version: 1.0.0

MicroEdition-Configuration: CLDC-1.1

MicroEdition-Profile: MIDP-2.1


Konklusion l.jpg

Konklusion

  • Reach

    • Tja, i teorien

    • Man kan dog komme langt

  • Code once, deploy many

    • Nok snarere: Code a couple of times, deploy many


  • Login