Monday, September 19, 2011

PAW and DynDNS

From time to time I get requests from users who would like to have a DynDNS integration into PAW.
I thought about it ... but it just doesn't make much sense, because there are enough apps in the Android Market that do exactly this.
So I will not provide a plug-in or another means of DynDNS integration, but for those of you who would like to experiment here is a basic BeanShell implementation of the DynDNS API:

import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.*;
import org.apache.http.client.methods.*;
import org.apache.http.util.*;
import org.apache.http.auth.*;

    Host, username and password settings
hostname = "";
user = "";
password = "";

    Get IP number
client = new DefaultHttpClient();  
getURL = "";
get = new HttpGet(getURL);
responseGet = client.execute(get);  
resEntityGet = responseGet.getEntity();

if (resEntityGet != null) {
  // Extract IP number
  ip = EntityUtils.toString(resEntityGet).replaceAll(".*?([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}).*", "$1").replaceAll("[\n\r]", "");
  print("IP: " + ip);
    Send DynDNS update request
  updateURL= "" + hostname + "&myip=" + ip + "&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG";
  get = new HttpGet(updateURL);
  client.getCredentialsProvider().setCredentials(new AuthScope(null, -1),
new UsernamePasswordCredentials(user, password));
  responseGet = client.execute(get);  
  resEntityGet = responseGet.getEntity();
  response = EntityUtils.toString(resEntityGet);
  success = response.startsWith("good");
  // Print result
  print("Response: " + response);

Hostname, username and password have to be inserted into the script.

This implementation is not complete but should be a good start for further development.
To start the script automatically when PAW starts, put it in the paw/autostart or paw/etc/rc.* folder.

The API is quite easy and it should not take too long to get a complete implementation up and running ...

Thursday, September 15, 2011

PAW and DavDrive on Google TV

So now that the Google TV emulator is out and my Linux box supports KVM I tried PAW and DavDrive.

The only problem I had was that /sdcard was mounted read only and thus PAW could not extract its content and DavDrive could not write files.
To solve this issue I opened an ADB Shell and remounted the root file system via mount -o remount,rw /.

Apart from that everything worked fine. Compared to the Honeycomb emulation the Google TV emulation was quite fast.

Below are screen-shots of the two apps running on Google TV.

PAW running on Goolge TV

DavDrive running on Google TV