refactor device phonegap module