SyntaxHighlighter

Monday, March 14, 2016

Card Game Project - Deployment

With some working components, and before jumping into the game logic, I want to try out building a native version for at least Android.

Cordova


Building with Cordova worked pretty well. I spent more time installing packages than I did building the app. The best part was the app works and looks great on the device. Special thanks to this blog for documenting their steps as well.
npm install -g cordova
cordova -v
Installing with npm is a breeze. I am using Cordova 6.0.0.
cordova create polycardwarapp com.chimmelb.polycardwar PolyCardWar
This initialized my application in the polycardwarapp directory.
cd polycardwarapp/
cordova platform add android
Build my dist/ directory and copy it to the /www directory of the app.
cd ..
cp -R dist/ polycardwarapp/www/
cd polycardwarapp/
cordova build android
This is where I got stuck. I add the Android SDK tools installed but either never used them, or needed to update them. 
android update sdk -u -a
That command made me agree to many EULAs, and started updating some build tools. I waiting while updating 24, 23, 22, 21 and quit soon after that. Then the build worked flawlessly.
cordova emulate android
Emulator was OK, and installed the apk created at platforms/android/build/outputs/apk/android-debug.apk on my phone. Started up quickly and was responsive. 

PhoneGap


The instructions for PhoneGap building were pretty straightforward, and was more app-based than command line. I followed their instructions for the sample app, copied my dist/ directory into the www/ folder, and the next build worked! 

I was suprised to read this: 
Apache Cordova is the engine that powers Adobe PhoneGap™, similar to how WebKit powers Chrome or Safari. 
...so perhaps that's why these were two positive experiences.

Mobile Chrome App


My first try was the documentation to build a chrome app, included in Polymer. This worked enough to build an app, but the routing in the app didn't work for me and kept getting toasts about not finding certain app paths.

Next Steps


I'm sure Cordova and PhoneGap have many more options, like the icon for the app, portrait-only view models and other cool things. I sometimes get an app routing error when first starting the game, and there could be other errors hiding about that will only be visible in an app format, rather than on the web browser (PhoneGap's tooling would probably be more useful in that case too). The Crosswalk project is also an option (or plugin) that could be useful.

But deployment is possible, and that's what I intended to find out. The game needs a lot more logic, but the layout and user input ("clicking") all worked on a mobile device in an app format. A more formal solution would be needed before hitting an app store, but the biggest risk of "Is this even possible?" has been cleared, so we can continue back to the app!

Tracking

This was another day, though there were some other project hurdles to handle today. And like I eluded earlier, installing android packages was a bigger time-sink than anything else. The actual build tools worked great! 


No comments:

Post a Comment