Thomas Riisgaard Hansen 2009 © Programming for Mobility Thomas Riisgaard Hansen, ([email protected]) University of Aarhus, Denmark http://www.daimi.au.dk/mobile
Dec 22, 2015
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 ©
Voice takes of 12 % of the time we use smart phones today!
Source: Smartphone360 study 2007
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
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
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
…
Thomas Riisgaard Hansen 2009 ©
SmartPhone by OSOS
http://www.gartner.com/it/page.jsp?id=754112
Thomas Riisgaard Hansen 2009 ©
SmartPhonesOS
Thomas Riisgaard Hansen 2009 ©
Red Ocean Scenario - The mobile battlefield
Complete Web Experience
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 ???
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 …
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
Thomas Riisgaard Hansen 2009 ©Chess seminar, UC Berkeley
Programming Mobile Devices
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?
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
Thomas Riisgaard Hansen 2009 ©
Mobile Browser
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>
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
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
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")
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
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}
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.
Thomas Riisgaard Hansen 2009 ©
J2ME Overview
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) {}
}
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) {}}
Thomas Riisgaard Hansen 2009 ©
JavaFX
Thomas Riisgaard Hansen 2009 ©
And
roid
– A
ndro
id -
And
roid
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>
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
Thomas Riisgaard Hansen 2009 ©
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(); } }}
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++
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
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; } }
Thomas Riisgaard Hansen 2009 ©
Symbian next step?Opensource, OpenC, Maemo, QT
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
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
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