Wednesday, 21 September 2016

Cordova phone keyboard 'Go' button event

If you need to capture the keyboard's 'Go' button event to automatically submit your form, do something like this, where I'm capturing keypresses during password field focus and checking to see if it's the Go button:

 $('#loginPassword').on('keypress',function(e){ if (e.keyCode == 13)
                } });

Monday, 29 August 2016

Headspace app store subscription phishing scam

I got quite a convincing phishing email today, it looked like a legit app store receipt for the Headspace, for £9.99. Many of the links go to Apple, and the link at the bottom 'Cancel and Manage my subscriptions' goes to something that looks like the App Store, but had my email address appended to the end.

I removed my address and visited the link If you input realistic data, it asks you for more information about yourself, and you may think you're correcting your erroneous headspace subscription.

If however, like me, you put in something like f*** they redirect you to google with a search for something child-porn related. These people are real nice huh.

Tuesday, 12 July 2016

JQuery mobile go back in history using Javascript

It's not clear at all in the documentation, but here it is:
And if you want to use this to make the Android back button work properly on your Cordova app, do this:

document.addEventListener("backbutton", onBackKeyDown, false);
        function onBackKeyDown() {

Tuesday, 21 June 2016

Cordova CLI build commands for Windows 10 and Windows Phone 8.1

By default the cordova build command produces two packages: Windows 8.1 and Windows Phone 8.1. To upgrade Windows package to version 10 the following configuration setting must be added to configuration file (config.xml).
 name="windows-target-version" value="10.0" />

Once you add this setting build command will start producing Windows 10 packages.
You may decide that you want to build a particular version of your application targeting a particular OS (for example, you might have set that you want to target Windows 10, but you want to build for Windows Phone 8.1). To do this, you can use the --appx parameter:
cordova build windows -- --appx=8.1-phone
The build system will ignore the preference set in config.xml for the target Windows version and strictly build a package for Windows Phone 8.1.
Valid values for the --appx flag are 8.1-win8.1-phone, and uap (for Windows 10 Universal Apps). These options also apply to the cordova run command.

Component requires .NET Native compilation, not available targeting Windows10, AnyCPU

I've been having more pain with Cordova for Windows phones. I updated my Cordova CLI to 6.2.0 to overcome a problem I was having in Cordova/lib/prepare.js when building. It seems to work, but then a new problem appeared - or perhaps it was the same problem but with a more friendly message:

The following component requires .NET Native compilation which is not available when targeting 'Windows10' and 'AnyCPU'. Please consider changing the targeted processor architecture to one of the following: 'x86, x64, ARM' (if you are using command line this could be done by adding '--archs' parameter, for example: 'cordo va build windows --archs=x64'). C:\PathToMyProject\platforms\windows\plugins\cordova-plugin-globalization\GlobalizationProxy.winmd Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe: Command failed with exit code 1
To overcome this I had to do what it said. The following command created a successful build:

cordova build windows --archs=x86