Add support for running inside of phonegap