Category Archives: Android

Ionic – CORS with Live Reload

File this one under ‘lessons learned from hours spent chasing my tail’.

Recently, I’ve been working quite a bit with the Ionic Framework… While I can’t say that I was initially on board for the whole ‘hybrid app’ approach for mobile development, I’ve really grown to love the stack and find it fun to work in. Fun development aside, this isn’t to say that the stack (like any stack) is without its issues – for me currently, it’s the undocumented (or the only-documented-in-a-github-issue) gotchas that can create the largest headaches, as they can often result in an hour or two of tail-chasing.

As you’ve likely gathered from this post’s title, the most recent fun on this front was trying to chase down a CORS issue when testing a tablet application that I am currently writing. In this application, we’ve opted for custom auth headers – adding which caused the CORS issues to rear their ugly head…  In my case, it was specifically issues with Access-Control-Allow-Headers.

“No big deal – Cordova/Phonegap whitelists all domains, so you’re good to go”, right?  As is often the case, “no big deal” can be filed under the category of “famous last words” here…

Not previously known to me, apparently using -l(/livereload) causes a modification to the config.xml at runtime for that build – a modification that removes the ‘*’ whitelisting, which can result in banging your head against CORS issues when interfacing with a REST service during development using livereload…

For the skinny, check out the github issue discussing this – https://github.com/driftyco/ionic-cli/issues/89

Unfortunately, Googling for “Ionic CORS” will provide you with a lot of noise that can result in some tail chasing as you start following suggestions to delete client side default headers or researching server-side solutions to mask the problem… Googling for “livereload CORS” however will take you to some relevant information via Grunt livereload Server discussions.

In the end, it was just easiest to configure my development web server to allow the CORS operations, as I wanted to keep Live Reload capabilities with the least amount of fuss. There are some client side things that you can do (discussed in the linked thread), but as you will find, those are temporary and will need to be done over and over as you develop… I’ve also read some mention of configuring a Grunt proxy server to proxy these requests ‘locally’, but I’ve not been able to investigate that approach, so I can’t really speak to it, though I’d love to get some input on this approach if any readers have any…

Anywhos… I just wanted to put this out there in case “Ionic CORS” led anyone else on a wild goose chase.

Happy Developing!

-Matt

To CM9 a0.5 or not to CM9 a0.5 – that is the question…

Of course, I have been anxiously watching the development of custom roms for the HP Touchpad… I am really happy to see not one, but TWO releases (Alpha 0 and Alpha 0.5) of CM9 for the Touchpad so far!  Great work from the Cyanogenmod team!

So far, I have been too gun shy to pull the trigger up fumble through the Acme2 process… With the outstanding issues list still holding the video hardware playback problems for Alpha 0.5, I think I may still hold off for a bit…

What about you? Any casual browsers of the site rocking CM9 on their HP Touchpad?  Worth it?

Perhaps I will have a hands-on for you this week… perhaps…

Links:

http://rootzwiki.com/topic/15509-releasealpha05-cyanogenmod-9-touchpad/

http://liliputing.com/2012/01/cyanogenmod-9-alpha-0-5-bug-fix-for-the-hp-touchpad.html

 

Edit: hands on review soon 😉

 

Touchpad Mod Upgrades – Bump to Cyanogenmod Alpha 2 and WebOS 3.0.4 while maintaining dual boot heaven (easy)

Note: I performed the below from Ubuntu 11.04 x64

After this process, you will be on CM7 a2 (newest Cyanogenmod – steps 1-2) and WebOS 3.0.4 (newest – steps 3).  Once you pull the WebOs update, moboot (what let you pick which OS to boot to) will no longer be the active bootloader.  But we have you covered (steps 4 – 7) – you will be booting via moboot in no time flat!  WOOT!

 

1) Download CM7 a2 update from here (http://rootzwiki.com/showthread.php?4011)
2) Upgrade to CM7 alpha 2 via clockworkmod Clockworkmod using the file obtained from step 1
3) After CM7 upgrade, reboot into web os and pull 3.0.4 OTA WebOs update
4) Connect Touchpad to PC and put in USB mode.
5) Create ‘cminstall’ folder on touchpad and then copy ‘update-moboot_0.3.3.zip’ to the folder (should have this file from when you installed CM7 a1).
6) Eject Touchpad and restart into USB Mode (Large White USB Icon) by  holding “Power + Volume Up”
7) Locate the ACMEInstaller that you originally loaded CM7a1 on your touchpad with and execute “novacom boot mem:// < ACMEInstaller” from terminal and let it do its magic…

You are up to date to date and dual booting again with the latest and greatest.

 

Disclaimer: Do this at your own peril.  I accept no responsibility for your clearly questionable judgement – an observation supported by your doing of random things that strangers on the Interwebs tell you to do to your expensive electronic devices for hopes of some supposed small technical gain… You have been warned of your insanity. This said, everything here worked perfectly for me 😀