PhoneGap: Detect if running on desktop browser

I use this code: if (navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|IEMobile)/)) { document.addEventListener(“deviceready”, onDeviceReady, false); } else { onDeviceReady(); //this is the browser } UPDATE There are many other ways to detect if phonegap is running on a browser or not, here is another great option: var app = document.URL.indexOf( ‘http://’ ) === -1 && document.URL.indexOf( ‘https://’ ) === -1; … Read more

Cordova: start specific iOS emulator image

To find out what are the simulator images available you can use to list them $ cordova emulate ios –list Available iOS Virtual Devices: iPhone-4s, 9.3 iPhone-5, 9.3 iPhone-5s, 9.3 iPhone-6, 9.3 iPhone-6-Plus, 9.3 iPhone-6s, 9.3 iPhone-6s-Plus, 9.3 iPad-2, 9.3 iPad-Retina, 9.3 iPad-Air, 9.3 iPad-Air-2, 9.3 iPad-Pro, 9.3 Then use one of the simulator names … Read more

Cordova app not displaying correctly on iPhone X (Simulator)

I found the solution to the white bars here: Set viewport-fit=cover on the viewport <meta> tag, i.e.: <meta name=”viewport” content=”initial-scale=1, width=device-width, height=device-height, viewport-fit=cover”> The white bars in UIWebView then disappear: The solution to remove the black areas (provided by @dpogue in a comment below) is to use LaunchStoryboard images with cordova-plugin-splashscreen to replace the legacy … Read more

Update cordova plugins in one command

I got tired of manually checking for plugin updates so created a tool to do it for me: https://github.com/dpa99c/cordova-check-plugins Install it globally: $ npm install -g cordova-check-plugins Then run from the root of your Cordova project. You can optionally update outdated plugins interactively or automatically, e.g. $ cordova-check-plugins –update=auto

Error executing command ‘ant’ on Mac OS X 10.9 Mavericks when building for Android with PhoneGap/Cordova

The error message proved to be true as Apache Ant isn’t in the path of Mac OS X Mavericks anymore. Bulletproof solution: Download and install Homebrew by executing following command in terminal: ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)” Install Apache Ant via Homebrew by executing brew install ant Run the PhoneGap build again and it should … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)