PhoneGap Android: How to force Application to use icons from asset\www\res instead res\drawable folder?

config.xml is used only by the PhoneGap Build service. – Building locally, this file is ignored and the files in your res/drawable directory are used. – Building with PGBuild, the service looks for this file at the root of your project (next to index.html) and uses it to identify what images should be copied into … Read more

Using environment variables / parameterizing config.xml

I’ve achieved that creating a template config.xml (the file is config.tpl.xml) and a before_prepare cordova hook to replace the variables in the template with the correct values and save the generated content in config.xml. The cordova hook uses the npm package es6-template-strings: npm install es6-template-strings –save-dev The hook is: #!/usr/bin/env node var fs = require(‘fs’); … Read more

Custom Fonts in Android PhoneGap

I made it work after doing the following steps: -Put your CSS in a file, for example my_css.css: @font-face { font-family: “customfont”; src: url(“./fonts/arial.ttf”) format(“opentype”); /* Make sure you defined the correct path, which is related to the location of your file `my_css.css` */ } body { font-family: “customfont”; font-size:30px; } -Reference your CSS file … Read more

How to prevent keyboard push up webview at iOS app using phonegap

On focus, set window.scrollTo(0,0); This prevents keyboard from pushing up webview completely $(‘input’).on(‘focus’, function(e) { e.preventDefault(); e.stopPropagation(); window.scrollTo(0,0); //the second 0 marks the Y scroll pos. Setting this to i.e. 100 will push the screen up by 100px. }); If you don’t want to set a static value for your Y scroll position, feel free … Read more

Playing local sound in phonegap

You can use window.location.pathname to get the path of your application in any PhoneGap app. That way you don’t have to hardcode it for Android. It will look something like this on iPhone: /var/mobile/Applications/{GUID}/{appname}.app/www/index.html And this on Android: /android_asset/www/index.html Strip off the /index.html, prepend file://, and append your file test.wav. Demo: http://jsfiddle.net/ThinkingStiff/r7eay/ Code: function getPhoneGapPath() … Read more

cordova platform add android not working while listing Android targets

To work, this cordova command needs to use some programs located into your sdk/tools directory. You need also have installed apache ant. Then you must add these directories into your PATH system variable: Background: let’s assume you have installed your Android SDK to the c:\sdk\android directory you have installed you Apache ant to the c:\tools\apache-ant … Read more