Monday, February 15, 2016

fx-tictactoe: Deploy a JavaFX app into the google play store

This time I'll describe what is necessary to get a JavaFX application into the google play store.


[The postman on his round in the mountains between Tregaron and Abergwesyn]



To start with, you'll need a JavaFX application first. For this blog post I thought it would be a good idea to continue the work on my fx-tictactoe game  - which is in no way finished or 'production ready' - but it shows in principle what has to be done. If you haven't read the blog post about how to deploy the app to an android device yet, I would recommend to do it now.

Ok, we have an application which deploys happily on the android platform, but one last obstacle has to be taken to really nag all your relatives and friends for downloading your newest app from the google store.

Again I'm happy that the obstacle is rather a small one, since again it seems that the javafxmobile-plugin does the hard work for us. In fact, you only have to provide a small addition to the build.gradle file which handles the signing part, that is it points the wrapped android plugin to your keystore file.

Here is the build.gradle file:


You can see that not much changed since the last blog post, only the signing information had to be added. Another small thing which should get your attention is the AndroidManifest.xml file, which serves as a bootstrapper to launch your JavaFX application on Android.

If we have a closer look at it:


we can see that there is the javafxports.android.FXActivity class which delegates the control flow sometime to our main app - the FXActivity ensures that Mr. Bob Developer doesn't have to struggle with Android specifics at all and can concentrate on the hurdles of app development itself.

(Of course there are huge differences between those systems which can't be neglected, but this is not in scope for this discussion.)

Anyhow, I'm very happy to be able to deploy JavaFX apps to the app store - in fact it took me longer to answer all compliance questions and do the artwork for the app and the store listing than to "port" the app to Android (ok exaggerating - but close ;-) )


fx-tictactoe in action

Click here if you want to see the google app store listing for fx-tictactoe, or click here for the source code on github.