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…
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
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
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?
Run Demo
Tetris and Java WORA: Write Once, Run Anywhere?
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
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…
Android Market
Software Design
Divide and Conquer
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?
And we get … Controller View Model Main loop + event handling Only concerned with display of game objects Model Game model (2d array of blocks) Shape model
Class Diagram
Main Loop
Event Handling
move() method of Shape
Careful: how not to wait!
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!