Programming For Artists Term 2 MFA Computational Studio Arts Starting to program for mobile phones
Where we are: Week 7: 23 rd group Tutorials/ intro to mobile programming /Nabil present Week 8: 2nd March Interim presentations/what is a methodology? Week 9: 9 th group tutorials /parameters,documentation/research contextual references to discuss Week 10:16 th 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 CLDC Mac OS X: Mpowerplayer SDK Note the location of the installation on your computer How to install Mobile Processing:
3. Install Mobile Processing
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 profiles Find out about phones, which ones will work etc, go here:
The IDE should feel very familiar
The main difference is that when you run a program It takes a little bit longer to appear, and when it does you get …
THIS! Here the emulator is indicating which key you should press to launch 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 such as BlueJ or Processing
Back in Mobile Processing… Here Ive 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 // // 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 that come with mobile Processing Familiar code structure
Simplest possible example. I will export it as a MIDlet and transfer it to my phone Where 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 web this will have the emulator in it, use export Applet. These are the files I will put in my mobile phones folder. The folder I use on my phone is called games.
I use a cable to connect my phone to the computer via USB You 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.jad file and it runs on my laptop as an Emulator, its also on my phone.
throw will randomly generate a hexagram, I like the idea of combining mobile phone technology and a divination system that is 5000 years old….. The idea is that clicking on i will explain what the hexagram signifies, Ive set up the structure to do this (on a rainy day….)
Libraries for Mobile Processing: (growing)
Good place to start
Does come with basic sound capabilities Try the useful sound example, includes midi and audio files
Good examples…
Etch-a-sketch?
There arent that many books on mobile phone programming available at the moment.This one is quite useful, as it accommodates beginners. Its available in paper and e versions BUT SINCE I FIRST TAUGHT THIS CLASS MORE AND MORE INFO AVIALABLE NOW, especially for IPHONES
Interim presentations next week