programming for artists term 2 mfa computational studio arts starting to program for mobile phones

Post on 28-Mar-2015

221 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Programming For ArtistsTerm 2

MFA Computational Studio Arts

Starting to program for mobile phones

Where we are:

Week 7: 23rd group Tutorials/ intro to mobile programming /Nabil presentWeek 8: 2nd March Interim presentations/what is a methodology?Week 9: 9th group tutorials /parameters,documentation/research contextual references to discussWeek 10:16th group tutorials / discuss equipment needs/work on projects

Week 11 23rd Final presentation: Hand in work (and written work) Put all on web

Have you all put your project brief on the web?

• No mouse input as such

• So much more reliance on keys

• Very similar to Processing, some code differences

• Different ( and fewer libraries )

• Can you think of any significant differences between a phone and a computer/laptop ?

Crash introduction to mobile Processing

Similar reference pages

1. Download and install a Wireless Toolkit (WTK) for building mobile phone applications.

Windows: Sun Java Wireless Toolkit for CLDChttp://java.sun.com/products/j2mewtoolkit/

Mac OS X: Mpowerplayer SDKhttp://www.mpowerplayer.com/products-sdk.php

2. Note the location of the installation on your computer

How to install Mobile Processing:http://mobile.processing.org/

3. Install Mobile Processinghttp://mobile.processing.org/download/index.php

4 .Run Mobile Processing. Choose Preferences from the main drop-down menu. In the Preferences dialog box, go to the Mobile tab, and enter the location of the WTK.

These are my settings in the preferences

Phone profilesFind out about phones, which ones will work etc, go here:http://mobile.processing.org/phones/index.php

The IDE should feel very familiar

The main difference is that when you run a programIt takes a little bit longer to appear, and when it does you get …

THIS!Here the emulator is indicating which key you should press tolaunch the program. A java mobile program is called a MIDlet a variation on the word applet.Instead of the window we get in a regular applet, mobile Processing generates an emulator.

p.s In the Sun Java toolkit IDE you can choose from various models of phone.There are also other good examples in the toolkit, including GPS examples

The java toolkit is worth using as well…but it is more complex and not really like an IDE suchas BlueJ or Processing

Back in Mobile Processing…

Here I’ve pressed the key with 2 on it,This program displays the key,the keyCode,and the rawKeyCode.

The system variable keyCode is used to detect special keys such as the UP, DOWN, LEFT, or RIGHT The system variable key always contains the value of the most recently pressed key on the keyboard.

The system variable rawKeyCode represents the value of the last key pressed, as reported directly from the phone. This is useful when a phone has non-standard keys that do not map to characters (as with the key variable)

// keycode// by Francis Li <http://www.francisli.com/>//// A simple key profiling example (and handy utility) that// shows the value of key presses as returned by the different// system variables in Mobile Processing- key, keyCode, // and rawKeyCode. This particular example runs on MIDP 2.0// phones only since it uses the Phone library to run// fullscreen. When running fullscreen, softkey buttons // return key events, but the values of the rawKeyCode for// softkey buttons are not defined in the MIDP standard- they// are not only different between manufacturers, but can even be// different between phones from the same manufacturer.//// Created 06 March 2008//import processing.phone.*;

Phone p;

PFont font;

void setup() { p = new Phone(this); p.fullscreen(); font = loadFont(FACE_PROPORTIONAL, STYLE_PLAIN, SIZE_LARGE); textFont(font); textAlign(CENTER); fill(0); noLoop();}

void draw() { background(255); text("Key:\n" + key + "\n\nkeyCode:\n" + keyCode + "\n\nrawKeyCode:\n" + rawKeyCode, 0, 0, width, height);}

void keyPressed() { redraw();}

This program is In the examples thatcome with mobileProcessing

Familiar code structure

Simplest possible example.I will export it as a MIDlet andtransfer it to my phoneWhere I will then install it

Exporting a MIDlet

To make your porgram work in a real mobile phone you need to export it, Use ‘Export MIDlet’.

you can also make a strange applet to put on the webthis will have the emulator in it, use export Applet.

These are the files I willput in my mobile phone’s folder.The folder I use on my phoneis called ‘games’.

I use a cable to connect my phone to the computer via USBYou could also use Bluetooth to transfer the application to your phone, or upload it to the internet and download it through your phone's browser.

The cable works best for me…

• I connect the phone and a dialogue on my phone opens • it says ‘file transfer’ I ignore it and use the folder window that opens as if it was a memory stick.

• I put the folder containing the MIDlet files (simple_example) into a folder called ‘other’ on my mobile phone.

• Then I disconnect the cable and find my way to the folder called ‘other’ on my phone.

• I find the simple_example folder.• When I click on it (it has the word ‘java’ beside it ).it asks me if I want to install, which I do.

• It asks me where I want to install it too, I can choose between a ‘games’ folder or a folder called ‘applications’.

• I choose to save it in the folder called ‘games’ . Then it asks me if I want to start my program.

• I confirm ‘yes’ and I soon see my red circle on the mobile phone screen !

A game I made about Streatham high road

My I Ching mobile phone program.I can click on the mobIChing.jadfile and it runs on my laptop as an Emulator, it’s also on my phone.

‘throw’ will randomly generatea hexagram, I like the idea of combiningmobile phone technology and a divination system that is 5000 years old…..The idea is that clicking on ‘i’ will explain whatthe hexagram signifies, I’ve set up the structure todo this (on a rainy day….)

Libraries for Mobile Processing:(growing)

http://mobile.processing.org/learning/tutorials/index.php

Good place to start

Does come with basic sound capabilitiesTry the useful sound example, includes midi and audio files

Good examples…

Etch-a-sketch?

There aren’t that many books on mobile phone programmingavailable at the moment.This one is quite useful, as it accommodates beginners.

It’s available in paper and e versions

BUT SINCE I FIRST TAUGHT THIS CLASSMORE AND MORE INFO AVIALABLE NOW, especially for IPHONES

Interim presentations next week

top related