Releasing your Libgdx game on Android

It has been a long way till here. You are now about to generate an Android Application PacKage (apk) file for your own game. Fortunately, the hardest part is done and creating it is quite easy.

You will also discover some features to explore that Google provides to enrich your game experience as much to players as to developers.

Getting ready

All you need to go further on this recipe is a Libgdx Android project, for instance, samples-android along with the core one, such as samples-core. Make sure you have the Android Development Tools (ADT) plugin installed in your Eclipse IDE. It is available at http://developer.android.com/sdk/installing/installing-adt.html.

How to do it…

Once the environment is properly set up, the process is quite simple:

  1. Right-click on your Android project. Then, click on Export. Go to Android | Export Android Application. Then, click on Next.
  2. In the current window, just check that the selected project is compatible with Android. Click on Next.
  3. This step depends on whether you already have a keystore or you need to create one. It is necessary to sign applications so they can be uploaded to the Google Play store. It is a binary file in charge of storing a set of private keys.

    Enter a system path to store it along with a filename and a password. Click on Next.

    In order to create a private key for our keystore, enter an alias (it will just be useful to identify that key), password, validity (in years), and some personal data (first and last name or organization is enough). Click on Next.

  4. Finally, select a destination location for your final .apk file and click on Finish.

Your file is now ready to be uploaded to Google Play. All you have to do is link your Google account to your developer console. You can get access to such a console from https://play.google.com/apps/publish/.

It has cost of $25 that you just have to pay once.

Once inside, you will have a control panel to manage your app's life cycle: uploading, updating, maintaining, and removing.

Note that you can also distribute your application out of the market by enabling Unknown sources (Settings | Security) installations in the device.

Note

It is important to point out that Libgdx 1.0.0 and above can officially export to Android 2.2 or higher because it removes the support for OpenGL ES 1.x while preliminarily adding it for OpenGL ES, 3.0 although it is not stable yet. If you are interested in deploying for earlier Android versions, please use Libgdx 0.9.9. Be aware that incompatible features with the final device will just do nothing.

There's more…

Google Play Developer Console also provides you with a Game services option. You can find it within the touchpad tab:

There's more…

After accepting different Google Terms of Service, you will be allowed to add new games to your space. In this way, you will enable support for leaderboards, saved games, quests, rewards, and multiplayer. You can learn more about that at https://developers.google.com/games/services/.

The first step to integrate the service with your code is by installing Google Play Games Services within your Android SDK. Then, import as a library a copy of the project placed at <android-sdk>/extras/google/google_play_services/libgproject/google-play-services-lib/. Then, make your project depend on it and add the following lines to your manifest:

<meta-data android:name="com.google.android.gms.version"android:value="@integer/google_play_services_version" />

Finally, import the BaseGameUtils project that you can find within the Google Play Game Services GitHub space at https://github.com/playgameservices/android-basic-samples/tree/master/BasicSamples/libraries/BaseGameUtils.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.235.188