I decided that writing a completely separate ProjectPier API for our android app had to be the wrong decision considering the maturity of ProjectPier. Besides, I really didn’t feel like spending the afternoon writing a bunch of, likely redundant, wrapper methods for raw SQL queries. So, after spending a couple of hours digging through ProjectPier’s guts looking for a reasonable integration point I discovered the beginnings of an API controller.
The controller itself was abstract and did next to nothing but it prompted me to investigate it’s inheritance. It appears the unfinished ApiController class represents a split from the main dependency of ProjectPier controllers. Namely, controllers that will gather object data and drop it into a template to be human-viewable from a browser. The ApiController path will instead take object data and then output a condensed and strictly structured response for later manipulation by the requester. For our android client use we’ll be requesting the output in JSON formatting.
For starters I came up with a simple controller of my own to retrieve the list of projects. Here’s a simplified UML diagram of the controller hierarchy and where my API implementation now exists.
There is little argument that the most popular use of Android apps is to interact with previously existing web resources and this makes sense. They provide immediate value and benefit if the end-user is already a frequent visitor of the browser-based service. Following this model seemed to be a great way to enter into the Android development world and as such, I believe it be a reasonable choice for a class room project.
Ruth Waite and I decided to work on a client app for the open source project collaboration and management suite, ProjectPier. ProjectPier is a web-based application released under the AGPL and is written in PHP. It doesn’t contain a API for accessing data objects and structures specifically so we’ll be creating one as we go along. But, for the scope of this project the focus will be on Android programming practices and the web API will only need to be strictly functional.
For a high-level overview of the project take a look at this document: ProjectPier Client Overview PDF