© Ted Hagos, Mario Zechner, J.F. DiMarzio and Robert Green 2020
T. Hagos et al.Beginning Android Games Developmenthttps://doi.org/10.1007/978-1-4842-6121-7_11

11. Publishing the Game

Ted Hagos1 , Mario Zechner2, J. F. DiMarzio3 and Robert Green4
(1)
Makati, Philippines
(2)
Graz, Steiermark, Austria
(3)
Kissimmee, FL, USA
(4)
Portland, OR, USA
 

You can distribute your games quite freely and without much restrictions; you can let your users download it from your website, Google Drive, Dropbox, and so on; you may even email the game APK directly to the users, if you wish; but many developers choose to distribute their apps or games on a marketplace like Google or Amazon to maximize reach.

In this chapter, we’ll discuss the things you need to do to get your game out in Google Play. Here’s what we’ll cover:
  • Preparing for release

  • Signing the app

  • Google Play

  • App bundle

Prepare the Project for Release

There are three things you need to keep in mind when preparing for release; these are
  • Prepare the material and assets for release

  • Configure the project for release

  • Build a release-ready app

Prepare Material and Assets for Release

Your code is great and you might even think it’s clever, but the user will never see it. What they will see are your View objects, the icons, and the other graphical assets. You should polish them.

If you think the app’s icon isn’t a big deal, that could be a mistake. The icons help the users identify your app as it sits on the home screen. This icon also appears on other areas like the launcher window and the downloads section, and more importantly, it appears on Google Play. The icon weighs in a lot in creating the first impressions of the users about your game. It’s a good idea to put some work into this and read Google’s guidelines for icons which can be found here: http://bit.ly/androidreleaseiconguidelines.

Other things to consider if you will publish in Google’s marketplace are graphical assets like screen captures and the text for promotional copy. Make sure to read Google’s guidelines for graphical assets which can be found here: http://bit.ly/androidreleasegraphicassets.

Configure the App for Release

  1. 1.

    Check the package name—You may want to check the package name of the app. Make sure it isn’t still com.example.myapp. The package name makes the app unique across Google marketplace; and once you decide on a package name, you can’t change it anymore. So, give it some thought.

     
  2. 2.

    Deal with the debug information—Make sure you remove the android:debuggable attribute in the <application> tag of the Manifest file.

     
  3. 3.

    Remove the log statements—Different developers do this differently. Some would painstakingly go through the code and remove the statements manually. Some would write sed or awk programs to strip away the log statements. Some would use ProGuard, and others would use third-party tools like Timber to take care of logging activities. It’s up to you which you will use; but make sure that your users won’t accidentally see the log information.

     
  4. 4.

    Check the application’s permissions—Sometime during development, you may have experimented on some features of the application, and you may have set permissions on the manifest like permission to use the network, write to external storage, and so on. Review the <uses-permission> tag on the manifest and make sure that you don’t grant permissions that the game does not need.

     
  5. 5.

    Check remote servers and URLs—If the game relies on web APIs or cloud services, make sure that the release build is using production URLs and not test paths. You may have been given sandboxes and test URLs during development; you need to switch them up to the production version.

     

Build a Release-Ready Application

During development, Android Studio did quite a few things for you; it
  • Created a debug certificate

  • Assembled all your project’s assets, config files, and runtime binaries into an APK

  • Signed the APK using a debug certificate

  • Deployed the APK to an emulator or a connected device

All these things happened in the background; you didn’t have to do anything else but write your code. Now, you need to take care of that certificate. Google Play and other similar marketplaces won’t distribute an app that’s signed with a debug certificate. It needs to be a proper certificate. You don’t need to go to a certificate authority like Thawte or Verisign; a self-signed certificate will suffice. Also, make sure to keep that certificate; when you make updates to the app, you will need to sign it with the same certificate.

In the next steps, you’ll see how to generate a signed bundle or APK; you already know what an APK is—it’s the package that contains your application. It’s what you upload to Google Play. A bundle, on the other hand, is a lot like an APK but it’s a newer upload format. Like the APK, it also includes all your app’s compiled code and resources, but it defers APK generation. It’s Google Play’s new app serving model called Dynamic Delivery. It uses your app bundle to generate and serve optimized APK for each user’s device configuration—so they download only the code and resources that they need to run your app. You don’t have to build, sign, and manage multiple APKs anymore.

In Android Studio, the steps to generate an APK and a bundle are almost identical. In the following steps, we’ll see how to generate both the bundle and an APK.

Launch Android Studio, if you haven’t done so yet. Open the project, then from the main menu bar, go to BuildGenerate Signed Bundle/APK, as shown in Figure 11-1.
../images/340874_4_En_11_Chapter/340874_4_En_11_Fig1_HTML.jpg
Figure 11-1

Generate signed APK

Choose either Bundle or APK, then click Next; in this example, I chose to create a bundle. When you click Next, you will see the “Keystore” dialog, as shown in Figure 11-2.
../images/340874_4_En_11_Chapter/340874_4_En_11_Fig2_HTML.jpg
Figure 11-2

Keystore dialog

The Key store path is asking where the Java Keystore (JKS) file is. At this point, you don’t have it yet. So, click Create New. You’ll see the dialog window for creating a new keystore, as shown in Figure 11-3.
../images/340874_4_En_11_Chapter/340874_4_En_11_Fig3_HTML.jpg
Figure 11-3

New Key Store

Table 11-1 shows the description for the input items of the keystore.
Table 11-1

Keystore items and description

Keystore items

Description

Keystore path

The location where you want to keep the keystore. This is entirely up to you. Just make sure you remember this location

Password

This is the password for the keystore

Alias

This alias identifies the key. It’s just a friendly name for it

(Key) Password

This is the password for the key. This is NOT the same password as the keystore’s (but you can use the same password if you like)

Validity, in years

The default is 25 years; you can just accept the default. If publish on Google Play, the certificate must be valid until October of 2033—so, 25 years should be fine

Other information

Only the first and last name fields are required

When you’re done filling up the New Key Store dialog, click OK. This will bring you back to the Generate Signed Bundle or APK window, as shown in Figure 11-4; but now, the JKS file is created and the Keystore dialog is populated with it.
../images/340874_4_En_11_Chapter/340874_4_En_11_Fig4_HTML.jpg
Figure 11-4

Generate Signed Bundle or APK, populated

Click Next. Now we choose the destination of the signed bundle as shown in Figure 11-5.
../images/340874_4_En_11_Chapter/340874_4_En_11_Fig5_HTML.jpg
Figure 11-5

Signed APK, APK destination folder

You need to remember the location of the “Destination Folder,” as shown in Figure 11-5. This is where Android Studio will store the signed bundle. Also, make sure that the Build Variants is set to “release.”

When you click Finish, Android Studio will generate the signed bundle for your app. This is the file that you will submit to Google Play.

Releasing the App

Before you can submit an app to Google Play, you’ll need a developer account. If you don’t have one yet, you can sign up at https://developer.android.com. There’s a lot of assumptions I’m making about the next activities. I’m assuming that
  1. 1.

    You already have a Google account (Gmail).

     
  2. 2.

    You’re using Google Chrome to go to https://developer.android.com.

     
  3. 3.

    Your Google account is logged in to Chrome.

     
If your Google account isn’t logged in to Chrome, you might see something like Figure 11-6. Chrome will ask you to go select an account (or create one).
../images/340874_4_En_11_Chapter/340874_4_En_11_Fig6_HTML.jpg
Figure 11-6

Choose an account

When you get your Google account sorted out, you’ll be taken to the developer.android.com website, as shown in Figure 11-7.
../images/340874_4_En_11_Chapter/340874_4_En_11_Fig7_HTML.jpg
Figure 11-7

developer.android.com

Click Google Play, as shown in Figure 11-7.

Click Launch Play Console, as shown in Figure 11-8.
../images/340874_4_En_11_Chapter/340874_4_En_11_Fig8_HTML.jpg
Figure 11-8

Launch Play Console

You need to go through four steps to complete the registration, (shown in Figure 11-9):
  • Sign in with your Google account.

  • Accept the developer agreement.

  • Pay the registration fee.

  • Complete your account details.

../images/340874_4_En_11_Chapter/340874_4_En_11_Fig9_HTML.jpg
Figure 11-9

Google Play Console, sign up

Once you have completed the registration and payment, you will now have access to the Google Play Console, as shown in Figure 11-10.
../images/340874_4_En_11_Chapter/340874_4_En_11_Fig10_HTML.jpg
Figure 11-10

Play Console

This is where you can start the process of submitting your app to the store. Click the “Create Application” button to get started.

Key Takeaways

  • Before the users can experience your game, they will see the icons and other graphical assets first—make sure the graphical assets are just as polished as your code.

  • Strip your code of all debug info and log statements before you build a release.

  • Code review your own work. If you have buddies or other people who can review the code with you, that’s much better. If your app uses servers, RESTful URLs, and so on, make sure they are production ready and not sandboxes.

  • Before you can upload your app to Google Play, you need to sign your app with a proper certificate.

  • You’ll need a Google Play account if you want to sell your apps on Google Play. I paid a one-time fee of $25.

  • Don’t forget to test the game on a real device, as many kinds and sizes as you can afford.

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

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