38
Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, ([email protected]) University of Aarhus, Denmark http://www.daimi.au.dk/mobile

Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, ([email protected]) University of Aarhus, Denmark

  • View
    221

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Programming for Mobility

Thomas Riisgaard Hansen, ([email protected])

University of Aarhus, Denmark

http://www.daimi.au.dk/mobile

Page 2: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Voice takes of 12 % of the time we use smart phones today!

Source: Smartphone360 study 2007

Page 3: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Mobile Devices in transformation

• Speed– Super 3G (HSDPA)– WLAN– WiMax– 4G

• Screen sizes– 320x240 (Nokia N95)– 480x320 (iPhone)– 640x360 (N97)

• Hardware features– Touch, GPS,

Accelerometers, RFID, Noise Cancellation, pico-projectors, 8mp cameras

• Software– Phonebook/Facebook,

full browsers, dictionary, messenger, Twitter

Page 4: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Mobility and pervasive computing

• It is all about getting on the net• Producing and consuming content on the move• Synchronizing and providing complete

experiences

Page 5: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Who is going to control the value chain?

Hardware

manufacturesOperating system

providersService Providers Customers

NokiaSony-Ericsson

MotorolaSamsungPanasonic

Apple…

Vendor specificSymbian

MS MobileLinux

MacMobile Blackberry

PalmPre…

TDCSonofonVodafoneOrange

DoCoMo3

T-MobileCingular

Content providers

GoogleYahoo

Microsoft LiveApple

Page 6: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

SmartPhone by OSOS

http://www.gartner.com/it/page.jsp?id=754112

Page 7: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

SmartPhonesOS

Page 8: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Red Ocean Scenario - The mobile battlefield

Complete Web Experience

Page 9: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Business 1/3:

From service providers to app stores

• Top 10 iStore apps sell around 5000+ units a day in the US.

• Apple share 30 % / developer 70 %

• Equals– Gold rush …

• Coming soon– Windows®

Marketplace for Mobile

– Nokia Ovi Store– Palm App Catalog

• Service providers– Bypassed ???

Page 10: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Business 2/3:

Existing apps want to be mobile

• For example: Hotels.dk, home.dk, danskebank.dk, dr.dk, picasa, World of warcraft, office, send sms, gps-data, running route …

Page 11: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Business 3/3:

Dealing with ”free”• Cross-Subsidy

– Razors and blades– Cell phones

• Ad-supported– Media, More users to attract ad people

• "Freemium"– Up selling Old Model

• Old Model – Up selling: Give away 1 to sell 99%• New model: give away 99 % to sell 1 %

• Digital economics– Underlying cost of manufacturing and distribution dropped near zero as in

music

• Marketing– Free samples to generate word of mouth multiplied by web's viral power

• Gift Economy– Wikipedia

Ref

: C

hris

And

erso

n

Page 12: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©Chess seminar, UC Berkeley

Programming Mobile Devices

Page 13: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Who are the nature of the application?

Nature of the solution• Specialized tool?• Solution for a group?• Widely available to a

large audience?• Everyone?

• Competences in the company

Nature of the solution• Specialized tool?• Solution for a group?• Widely available to a

large audience?• Everyone?

• Competences in the company

Complexity• Non-interactive?• Interactive?• Highly Interaction?• Uses special phone

abilities?

Complexity• Non-interactive?• Interactive?• Highly Interaction?• Uses special phone

abilities?

Page 14: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Android Apps

Who is going to control the program environment?

SymbianSymbian

HardwareHardware

Nokia API

SymbianSymbian

HardwareHardware

Ericsson API

SymbianSymbian

HardwareHardware

Moap

.NET Mobile.NET Mobile

HardwareHardware

.Net API

AllAll

HardwareHardware

JVMJava Mobile

AllAll

HardwareHardware

BrowserHTML

AllAll

HardwareHardware

FlashPlayerFlash

OS Specific: Maximum Functionality

OS Independent: Maximum Portability

HardwareHardware

Python PluginPython

SymbianSymbian

LinuxLinux

HardwareHardware

Android

iPhone Apps

Mobile OS XMobile OS X

HardwareHardwareAllAll

HardwareHardware

BrowserWidgets

Palm Pre Blackberry

Page 15: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Mobile Browser

Page 16: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Exa

mpl

eCalling Phone numbers from a

web page<html>

<head>

</head>

<body>

<p> A normal Web page </p>

<a href="wtai://wp/mc;555-434-3453">Call my phone</a><br>

<a href="wtai://wp/mc;32">Call a SIP Phone Number</a><br>

</body>

</html>

<html>

<head>

</head>

<body>

<p> A normal Web page </p>

<a href="wtai://wp/mc;555-434-3453">Call my phone</a><br>

<a href="wtai://wp/mc;32">Call a SIP Phone Number</a><br>

</body>

</html>

Page 17: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Widgets

• Small web applications designed for one purpose

• S60 5th edition– Calendar Service API – Landmarks Service API – Location Service API – Application Manager Service API – System Info API – Messaging (SMS, MMS) API – Multimedia (media gallery) API – Contacts API – Sensor API

Page 18: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Python Ideal for initial prototyping and concept testing when functionality falls outside Java ME.

Python Ideal for initial prototyping and concept testing when functionality falls outside Java ME.

Python - Language

Page 19: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Exa

mpl

e

Python

import appuifw

import messaging

data = appuifw.query(u"Type your name:", "text")

nbr1 = “555-324-453"

nbr2 = “555-123-345"

txt = u"Greetings from:" +data

if appuifw.query(u"Send message to your 2 friends","query") == True:

messaging.sms_send(nbr1, txt)

messaging.sms_send(nbr2, txt)

appuifw.note(u"Messages sent", "info")

else:

appuifw.note(u"Well, your Messages are not sent then", "info")

import appuifw

import messaging

data = appuifw.query(u"Type your name:", "text")

nbr1 = “555-324-453"

nbr2 = “555-123-345"

txt = u"Greetings from:" +data

if appuifw.query(u"Send message to your 2 friends","query") == True:

messaging.sms_send(nbr1, txt)

messaging.sms_send(nbr2, txt)

appuifw.note(u"Messages sent", "info")

else:

appuifw.note(u"Well, your Messages are not sent then", "info")

Page 20: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Flash Lite Ideal for Graphics-heavy options with a market that can support the Flash Lite player.

Flash Lite Ideal for Graphics-heavy options with a market that can support the Flash Lite player.

Flash Lite

Page 21: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Exa

mpl

e

Exampleon(keypress "<left">){//vibrate phoneFSCommand2( "StartVibrate”, 10,0,0);//do something else}

on(keypress "<left">){//vibrate phoneFSCommand2( "StartVibrate”, 10,0,0);//do something else}

Page 22: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Programming in Java (Java Mobile)

Ideal for a portable solution, if the Java ME platform provides the needed functionality. Good for vertical applications that must be portable. Device-specific libraries exist for many devices and are commonly used for games, making them non-portable.

Page 23: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

J2ME Overview

Page 24: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Exa

mpl

e

Hello World J2MEimport javax.microedition.midlet.MIDlet;import javax.microedition.lcdui.*;public class HiSmallWorld extends MIDlet {

private TextBox textbox;public HiSmallWorld() {

textbox = new TextBox("", "Hi Small World!", 20, 0);}public void startApp() {

Display.getDisplay(this).setCurrent(textbox);}public void pauseApp() {}public void destroyApp(boolean unconditional) {}

}

Page 25: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Exa

mpl

e

Sending SMS messages

import javax.microedition.lcdui.*;import javax.microedition.midlet.*;import javax.microedition.io.*;import javax.wireless.messaging.*;

public class SMSMain extends MIDlet { public void startApp() { try {

String addr = "sms://+4526283397"; MessageConnection conn = (MessageConnection) Connector.open(addr); TextMessage msg = (TextMessage)conn.newMessage(MessageConnection.TEXT_MESSAGE); msg.setPayloadText("Hello World!"); conn.send(msg); } catch (Exception e) { }

} public void pauseApp() {} public void destroyApp(boolean unconditional) {}}

Page 26: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

JavaFX

Page 27: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

And

roid

– A

ndro

id -

And

roid

Page 28: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Broadcast receiver

Android

Activity Service Content Provider

Intent IntentFilter

<?xml version="1.0" encoding="utf-8"?> <manifest . . . > <application . . . > <activity android: name="com.example.project.FreneticActivity" android:icon="@drawable/small_pic.png" android:label="@string/freneticLabel" . . . > </activity> . . . </application> </manifest>

Page 29: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Windows Mobile Ideal for enterprise applications with an existing PC infrastructure and options for significant development investment.

Windows Mobile Ideal for enterprise applications with an existing PC infrastructure and options for significant development investment.

Windows Mobile

Page 30: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Page 31: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Exa

mpl

e

Windows Mobile C#using System; using System.Collections.Generic; using System.ComponentModel;using System.Data; using System.Drawing; using System.Text;using System.Windows.Forms;using Microsoft.WindowsMobile.PocketOutlook;using Microsoft.WindowsMobile.Status;

namespace TestPhone { public partial class Form1 : Form { public Form1() { InitializeComponent(); }

private void button1_Click(object sender, EventArgs e) { BatteryState bt = SystemState.PowerBatteryState; textBox1.Text = bt.ToString(); SmsMessage msg = new SmsMessage(“555-345-345", "Battery State: "+bt.ToString()); msg.Send(); } }}

Page 32: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Symbian Very powerful for general purpose development. The Symbian based S60 platform is strongly supported by Nokia with some support from other device manufacturers.

Symbian Very powerful for general purpose development. The Symbian based S60 platform is strongly supported by Nokia with some support from other device manufacturers.

Symbian C++

Page 33: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Symbian OS Overview

Symbian OS 6 Symbian OS 7 Symbian OS 8 Symbian OS 9

S60 1st ed S60 2nd edition S60 3rd ed

Feature pack 1

Feature pack 2

Feature pack 3

Availiable today

UIQ – Dead!Idou?

Feature pack 1

FP 2

MOAP

S60 5th ed

Page 34: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Exa

mpl

e

Hello World Symbian• Symbian Hello World- Five classes (5 .cpp + 5 .h files)- One ressource file- Approximately 200 lines of code!• So why use Symbian- Speed- Functionality

#include <avkon.hrh>#include <aknnotewrappers.h> #include "HelloWorld.pan"#include "HelloWorldAppUi.h"#include "HelloWorldAppView.h"#include "HelloWorld.hrh"void CHelloWorldAppUi::ConstructL() { BaseConstructL(); iAppView = CHelloWorldAppView::NewL(ClientRect()); AddToStackL(iAppView);}CHelloWorldAppUi::CHelloWorldAppUi() {}CHelloWorldAppUi::~CHelloWorldAppUi() { if (iAppView) { RemoveFromStack(iAppView); delete iAppView; iAppView = NULL; } }void CHelloWorldAppUi::HandleCommandL(TInt aCommand) { switch(aCommand) { case EEikCmdExit: case EAknSoftkeyExit: Exit(); break;

case EHelloWorldCommand1: { _LIT(message,"Hello!"); CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; informationNote->ExecuteLD(message); } break; default: Panic(EHelloWorldBasicUi); break; } }

Page 35: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Symbian next step?Opensource, OpenC, Maemo, QT

Page 36: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

iPhone SDK

• You will need a mac• Program in X-Code• Language is ObjectiveC

• You will need a mac• Program in X-Code• Language is ObjectiveC

Page 37: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

#import "Hello_WorldAppDelegate.h"#import "MyView.h"@implementation Hello_WorldAppDelegate@synthesize window;@synthesize contentView;

- (void)applicationDidFinishLaunching:(UIApplication *)application {self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]

autorelease];self.contentView = [[[MyView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]

autorelease];[window addSubview:contentView];UIView *mainView;UITextView *textView;mainView = [[UIView alloc] initWithFrame: [[UIScreen mainScreen] bounds]];

textView = [[UITextView alloc] initWithFrame: CGRectMake(10.0f, 10.0f, 320.0f, 480.0f)]; [textView setEditable:YES];

[window addSubview: mainView]; [mainView addSubview:textView]; [textView setText:@"Hello World"];

// Show window[window makeKeyAndVisible];

}- (void)dealloc {

[contentView release];[window release];[super dealloc];

}@end

Page 38: Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, (thomasr@daimi.au.dk) University of Aarhus, Denmark

Thomas Riisgaard Hansen 2009 ©

Next step:Networked devices and applications

Thank you very much for listening

Join or read more athttp://www.daimi.au.dk/mobile

Or contact:

Thomas Riisgaard [email protected] http://www.daimi.au.dk/~thomasr