Top Banner
Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering
20

Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Dec 28, 2015

Download

Documents

Tracy Porter
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Programming YOURMobile Phone

Professor Simon M. LucasSchool of Computer Science and

Electronic Engineering

Page 2: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Mobile (Cell) Phones

• First prototype: Motorola 1973• Commercial cell phones :– NTT Japan 1979– Motorola 1983– DynaTAC 8000X ($4,000)

• Subscribers:– 300,000 in 1984

• Over 3,000,000,000 now!• So much more than just a telephone…

Page 3: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Samsung Galaxy S II (2011)

• Android phone• GPS, Motion Sensors, Video etc• Powerful processor• 3G WIFI Router!• 1gb RAM + 8 GB Flash mem + SD• 1.2Ghz dual core processor (licenced

from ARM)• 800 x 480 Super AMOLED Plus screen• Kindle!• Programmable in Java• Very open marketplace for apps

Page 4: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Tetris

• Developed by Alexei Pajitnov in 1985– With the help of Dmitry

Pavlovsky and Vadim Gerasimov

– Popular in the west in 1986• The classic ‘casual game’

of all time

Page 5: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

EA Mobile

• Tetris is frequently top of the sales charts for mobile games

• But seems to be losing out on smartphones (e.g. iPhone, Android)

• Why?

Page 7: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Tetris and JavaWORA: Write Once, Run Anywhere?

Page 8: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Well, almost…

• The Java language may vary slightly between versions available for each platform

• New platforms such as Android have significant new APIs– API = Application Programmer Interface

• Some effort needed to port an application to a new platform

• But at least with Android, you can use the familiar Java language

Page 9: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Developing Mobile Java Apps

• Write Java for mobile platform– Using suitable API / platform e.g. Android

• Test on emulator or device• Deploy to mobile marketplace?– Or direct to phone

• E.g. Android Market• Can be free or paid-for apps• Get detailed download and usage stats– Use the stats to refine your app…

Page 10: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Android Market

Page 11: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Software Design

Page 12: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Divide and Conquer

Page 13: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Modelling Tetris: Object Oriented Approach

• Objects group together:– Data– Actions that can be performed on

them:• Methods

• In Java, each object is of a particular class

• Programming: design classes – Make objects of those classes

• What sort of classes might you design for Tetris?

Page 14: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

And we get …

• Controller – Main loop + event handling

• View– Only concerned with display of game objects

• Model– Game model (2d array of blocks)– Shape model

Page 15: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Class Diagram

Page 16: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Main Loop

Page 17: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Event Handling

Page 18: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

move() method of Shape

Page 19: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Careful: how not to wait!

Page 20: Programming YOUR Mobile Phone Professor Simon M. Lucas School of Computer Science and Electronic Engineering.

Summary

• Mobile phones: incredible technology– RF, hardware, telecoms, software

• Programming should be (and is!) lots of fun• Java’s a great language – Android is a great

mobile platform• Modern IDEs take the pain out of software

development• Study computing and electronics: be part of a

bright future!