Due: Tuesday May 29
In this homework, you have to create an app that keeps a local to-do list in synch with a remote server.
We have implemented the server, and provide you with the code to run it locally, and with a running instance.
The homework consists in writing the Android app that connects to the server.
The server is implemented as a web2py app. To get it to work, install web2py, and then upload and install the ToDoListServer packed application. It is really a one-click process. This gives you a local version of the server running on your laptop/PC, which is very useful for development.
We have also set up an online server: you can access it here (you can also use HTTP). Note that it has URLs of the following form:
In addition to the above URL, the server has also Json-serving URLs that are used to communicate with Android. These URLs are to be used with POST methods with some variables set; the list of the URLs, the variables that must be set, and the values returned (all returned values are Json-encoded) are described below:
An example of how to use these calls from Python is provided in two scripts to get the list of all items, and add items, attached.
Note that you have to edit these scripts, filling in the correct URLs, usernames, and passwords as appropriate.
You are strongly encouraged to study the server code (the main file is .../ToDoListServer/controllers/default.py).
Should the server go down for any reason, or become unresponsive, please write a message on the class discussion group, and we will take care of it. In any case, for development, you should be able to run a local version of it.
This is what you have to write. When your app is started, it should check that it has, among the shared preferences, your username and password. If not, the app must start a new activity that:
Once this is taken care of, your app should ask the server for the list of todo items, and display them.
At the top or bottom of the list of todo items, there should be a button that lets you add a new item (you don't need to switch activity, you can do as in the ToDo List apps in the book).
If you long-press on an item, it should be possible to delete that item (via a context menu).
Thus, you need a minimum of two activities.
You don't need to define a local database to store the items, since they are stored on the server. You need to communicate to the server item additions and deletions, so that the local and remote lists stay in synch.
If you like to provide additional functionality for the server, contact me with a proposed implementation (of a method in default/android... . json), and I can add it to the server for all of us to use.
Some resources you might find useful:
Please, do use the class discussion group for asking for help and clarifications.
Homework Submission