Friday, August 29, 2014

Run Local Flash Games in Linux

I recently upgraded to Linux Mint 17.  So far, the only issue I've run into is that my Flash (*.swf) files no longer run when I try to open them in a browser. Instead of playing my game, it tries to download the file from my local drive to my local drive.

I've checked all the forums. It look other distro's have the same issue. And the support bozo's all say you can't do that. This tells me that they are just reading from a script, because it has always worked before.

So what's the answer? Simple - the mime type association has been changed, probably at freedesktop.org, which is upstream from the distros. Here is how you can change it back:

$ gksudo gedit /usr/share/mime/packages/freedesktop.org.xml


Replace "vnd.adobe.flash.movie" with "x-shockwave-flash" and save.
Now update your mime types:

$ sudo update-mime-database /usr/share/mime


Now navigate to your *.swf file. You should see the old flash icon back. You can now right click on the file and open it directly in your browser.

Happy Gaming!

Friday, August 1, 2014

Releasing a Signed Cordova Apk from NetBeans 8

I'll show how to build a cordova android app in NetBeans 8, and release a signed apk file.

The first part is relatively easy. Start up NetBeans 8, and from the main menu select File -> New Project. This brings up the New Project dialog.

In the dialog 'Categories' open the Samples folder and select the HTML5 subfolder. In the dialog 'Projects', select the Cordova Maps Sample, and click Next, name the project and click Finish:


This generates the application. Open index.html in your root, connect your android phone to the usb and hit F6 to run the project.

You should see something like this on your phone:



That was the easy part. Net beans doesn't have any menu selections to build a signed apk that you can distribute. However, Cordova uses an ant build process, and NetBeans is ant friendly.

So, the first thing you need to do is create your key:

$ keytool -genkey -v -keystore myapp.keystore -alias myapp -keyalg RSA -keysize 2048 -validity 10000

The keystore utility will walk you through some questions. You'll need to enter your app name and password, app alias, alias password and developer name. The remaining can be defaulted.

Now, in NetBeans project explorer, select the files tab, and create a file named ./platforms/android/ant.properties. entering the following contents:

key.store=/home/bruce/Git/myapp/myapp.keystore
key.alias=myapp
key.store.password=password
key.alias.password=password


Now you can right-click on ./platforms/android/build.xml and select Run Target -> release:




It will take a minute or two, and the ant build process will generate  ./platforms/android/bin/MyApp-release.apk, a signed distribution file.







Maybe I was wrong - with a little tlc, NetBeans does have a menu selection to build your apk!