Notes and Frequently Asked Questions

Last updated: 2011-03-25

A few notes and a question…

Running Eclipse in C11

Note that there are TWO versions of Eclipse installed on the computers in C11; the one which you should use (with the relevant plugins installed) is C:\G54UBI\eclipse\eclipse.exe; you can check if you are running the right one from the menu Help >  About Eclipse SDK which should report version 3.6.1 (not version 3.4.something).

Starting AppInventor…

When you start first the blocks editor from the appinventor web page it asks for the location in which the local commands are installed; in the machines in C11 this is “C:\G54UBI\AppInventor\commands-for-Appinventor” as per slide 11 of http://www.cs.nott.ac.uk/~cmg/G54UBI/coursework2/coursework2_1_running_an_emulator.pptx

 Using the Android emulator…

It looks like the web proxy may not be set up automatically in the labs for the emulators; please refer to slide(s) 11 and 12 in http://www.cs.nott.ac.uk/~cmg/G54UBI/coursework2/coursework2_1_running_an_emulator.pptx if you need to access external web sites (e.g. google maps) and this is not working.

Note that there have been some recent issues where changing an environment variable in the system settings has resulted in the machine becoming unable to run any further programs. If this happens then logging out and logging back in appears to resolve the issue. If you still have problems with your account then please talk to Joe Best (room C15, generally between 10am & 12noon).

It appears that there is a problem with mock locations on the Android 2.3.3 emulator (it seems to crash/reboot the emulator). Please avoid using this version of the emulator; try Android 2.2 instead.

2D barcodes

One or two people seem to be planning to use 2D barcodes…

To use the barcode scanner component in appinventor (or phonegap) you need to install the application on the phone (or emulator): http://zxing.googlecode.com/files/BarcodeScanner3.53.apk

Note that you will need to set the proxy as above to do this on the emulator.

However the emulator doesn’t have a camera. So for development/testing you might want to use extra buttons or a list picker (in app inventor) to allow the user to simulate scanning particular barcodes. 

For more on using barcodes with phonegap see Maps_and_Barcodes_on_PhoneGap.html

Networked elements to projects…

I have creates/set up a web service based on the Google tinywebdb code base which should just allow appinventor (or phonegap) applications to share data in a simple (inefficient) way – appinventor’s tinywebdb is just a way to get/set strings associated with tags, i.e. a shared string map.

Links: 

As an extra path element (to keep your data separate from everyone else) use a string that is specific to you, e.g. your username, email address or a random string.

Telnet (for mock location input)

Apparently, <quote>

you can quickly re-enable Telnet by following these steps:

  1. Start
  2. Control Panel
  3. Programs And Features
  4. Turn Windows features on or off
  5. Check Telnet Client
  6. Hit OK

After that you can start Telnet via Command Prompt. 

</quote> - http://www.fettesps.com/windows-7-enable-telnet/

I found that on my account it was nominally already turned on but not working. After I turned it off (and hit OK) and then turned it back on, it worked.

Alternatively, the "DDMS" Perspective in Eclipse includes an emulator interface that allows you to enter lat and long directly and send to the phone.

Using a real phone

If a phone doesn't work when plugged into a machine in C11 (e.g. "adb logcat" doesn't find the phone or Windows reports unknown driver problems or similar) then please talk to Joe Best in room C15 (generally between 10am and 12noon) (Joe's University phone number is 14112 , which will forward to his mobile if he is not in the office). 

If you want to borrow a phone for testing or development (for 1-2 hours at a time) then please refer to email(s) for more information.

In theory you should be able to plug a phone into the computer's USB for development. This requires suitable drivers to be installed. Please talk to Joe Best (as above) if you have problems connecting the phone. Note: Joe and TSG are not there to help you with the details of the coursework itself, just problems with drivers, windows, and the like. 

Hopefully USB will work to charge the phones even without the sync working.

The other way to get applications onto the phone is to download the application ".apk" file over the wireless network. 

On AppInventor use the "Package for Phone" option "Download to this Computer". You'll then need to copy the .apk file to your CS web space (as per coursework2_3_staticweb.pdf) and then type the URL into the phone's browser. It should then download it and give you the option to install it. 

To install a new version you might have to uninstall the old one first (Settings > Applications > Manage Applications > (your application) > Uninstall 

With PhoneGap you should find the auto-built .apk file in the project's bin directory, e.g. H:\Private\workspace\HelloPhoneGap\bin\HelloPhoneGap.apk. Then copy to your CS web space and download as for AppInventor, above. 

What about studying people using the application?

See Studies_with_Users.html

Debugging PhoneGap Applications

Note that JavaScript (and hence PhoneGap) tend to be very poor at reporting errors. If you application doesn't do anything then there may well be an error in the javascript, e.g. a syntax error, mis-typed function name, etc.

A few extra helps with debugging are listed below. Apart from these the best tactic is generally to:

You can get some (limited) information on PhoneGap errors in the following ways:

For the stuff which is not dependent on sensors you can use a desktop browser's javascript debugging capability, e.g. in Google Chrome menu Tools > Javascript Console

In theory it might also be possible to get alerts on top-level JavaScript errors within the application/page, but this seems to crash my emulator at the moment, and has not been supported on at least some versions of the WebKit browser that PhoneGap uses, so unconfirmed at present. In theory you would include something like the following in your index.html file:

<script type="text/javascript">
// debug error handling helper
window.onerror=function(msg, url, linenumber){
alert('Error message: '+msg+'\nURL: '+url+'\nLine Number: '+linenumber);
return false;
}
</script>