phonegap api not working