After hearing that we were building an iPhone app for Customers I volunteered to write an Android version knowing that some of our Customer base are open source advocates or had Android phones.
There has been a discussion about fragmentation in the Android marketplace for as long as I can remember so the first choice was deciding on which version to set as a minimum.
Since the Dedipower Portal does most of the actual work the app didn’t need any of the features in the latest versions so I settled on the veritable 1.6 (donut), granted that only 6% of phones are still that low there is a chance that someone hadn’t got round to upgrading yet so decided to play it safe!
The App relies heavily on live data from the Portal so very little is cached on your phone after all if you are checking to see if you servers are up you don’t want the data to be out of date.
Communicating with the portal in the Android API is achieved very simply with the DefaultHttpClient class:
// Create a new HttpClient and Post Header
HttpParams params = new BasicHttpParams();
HttpClient httpclient = new DefaultHttpClient(params);
We then populate the HttpPost object with the URL that we’ll be posting to:
HttpPost httppost = null;
httppost = new HttpPost("https://portal.dedipower.com/api.php?format=json&action=cdn”);
The portal requires authentication for every request so we have to add a cookie containing our session details:
httppost.setHeader("Cookie","PHPSESSID=" + this.SessionID);
The portal returns all data as a JSON object so once it returns we check to see if the JSON string ‘success’ is true and then continue with processing the information for example;
JSONObject CDNs = API.PortalQuery("cdn");
if(CDNs.getString("success") == “true”)
CDNNodes = CDNs.getJSONArray("cdns");
CurrentCDN = CDNNodes.getJSONObject(1). getString(“name”);
Obviously there is a lot more error catching in the actual app but this is just an example.
The video below takes you through a quick preview of the features:
Hopefully you will find that most of the functionality you need to work with us in the Support teams (phone numbers, tickets etc) is there along with the ability to quickly check on the state of your Managed Servers, Colocation cabinets and CDN accounts.
There are a few differences in the Android App to the iPhone one, primarily it features the ability to save your credentials so you don’t have to type all that information in each time (if you don’t already I’d recommend utilising your phones lock screen if you use this feature!)
Secondly I haven’t implemented the ability to issue a remote reboot. I don’t know about you but the amount of times I’ve made a call from my pocket makes me hesitant about such a feature.
If you feel that this feature really needs to be in there or if you have any other feature ideas then give me a call on our normal number (office hours only please!) and let me know!