© Mario Zechner, J.F. DiMarzio and Robert Green 2016

Mario Zechner, J. F. DiMarzio and Robert Green, Beginning Android Games, 10.1007/978-1-4842-0472-6_15

15. Publishing Your Game

Mario Zechner, J. F. DiMarzio2 and Robert Green3

(1)Graz, Steiermark, Austria

(2)Celebration, Florida, USA

(3)Portland, Oregon, USA

The last step in becoming an Android game developer is getting your game to your players. There are two possible routes:

  • Take the APK file from your project’s build/ folder, put it on the Web, and tell your friends to download it and install it on their devices.

  • Publish your application on Google Play or Amazon App Store like a real pro.

The first option is a great way to let other people test your application before you throw it on the Google Play store. All they need to do is get a hold of the APK file and install it on their devices. The real fun starts once your game is ready for prime time.

A Word on Testing

As we’ve seen in the previous chapters, there are various differences among devices. Before you publish your application, make sure it runs well on a couple of common devices and different Android versions. There are a few ways to approach this problem. You can either purchase an array of devices with different hardware capabilities running different versions of Android and test in-house, or you can pay for any one of the new Android testing services. We are lucky enough to have several phones and tablets, covering different device classes and generations, for testing. Depending on your budget, though, neither of these approaches might be an option. You might have to rely on the emulator (but not too much, as it is indeed unreliable) or preferably on a couple of friends to help you out.

Another way to test your application is to put a beta version on the Google Play store. Google Play supports the use of invite-only beta channels where you can upload testable versions of your apps and invite others to test it.

If you look for outside testers, make sure you get coverage of most of the device generations. Newer devices should, of course, also be on your list, but less for reasons of performance testing than for compatibility testing. If nothing else, make sure you at least are testing on a few of the official Google devices, which include the Nexus Pixel, Nexus 6P, or even the Nexus 6 devices. If your game isn’t working well on these devices, you are sure to have trouble heading your way if you don’t make changes.

Finally, you have to accept the fact that you can’t test your application on all the devices out there. You are likely to receive error reports that are inexplicable and might well stem from the fact that a user is running a custom ROM that doesn’t behave as expected. In any case, don’t panic; this is normal to some extent. If the problem with errors goes overboard, though, you’ll have to try to come up with a scheme to battle it. Luckily, Google Play helps us out in that regard. We’ll see how that works in a bit.

Note

Apart from Google Play’s error-reporting feature, there’s another nice solution called Application Crash Report for Android (ACRA), which is an open source library specifically designed to report all crashes of your Android application. It’s available at http://code.google.com/p/acra/ and is very easy to use. Just follow the guide on the Google Code page to integrate it into your application.

Becoming a Registered Developer

Google makes it really easy to publish your application on the Google Play store. All you have to do is register an Android developer account for a one-time fee of $25 USD. Assuming you live in one of the countries on Google’s long list of supported locations for distributing applications, this account will allow you to post your apps on Google Play. Whether you can post free apps only or both free and paid apps depends on which country you live in. To post paid apps, you must live in one of the countries on Google's somewhat shorter list of supported locations for merchants. Google also has separate lists of countries to which you can distribute apps freely and countries to which you can distribute paid apps. Google is working hard to expand these lists so that your apps can reach the entire globe.

Your Google Play store publisher account is tied directly to a Google account. Unless restrictions have been lifted, you may not separate the publisher account from the Google account. It’s important to take that into account when deciding between registering with an existing account or registering with a new, dedicated account. Keep in mind that if you use an existing Google account and for some reason your publisher account is suspended, you will lose access to that existing Google Account. Once you’ve made that decision and have your Google account ready, visit https://play.google.com/apps/publish/signup and follow the instructions given there to register for the Google Play store.

In addition to your Android developer account, you will also need to register for a free Google Checkout merchant account if you want to sell your applications. You will have the option to do this during the developer account sign-up process. We’re not lawyers, so we can’t give you any legal advice at this point, but make sure you understand the legal implications of selling an application before you do so. If in doubt, consider consulting an expert on the matter. We don’t mean to scare you off by this, as the process is pretty streamlined in general, but you should be prepared to keep your government’s tax department apprised about your sales activity.

Google will take a percentage of your hard-earned money (30 percent, as of this writing) for distributing your app and providing the infrastructure. That seems to be pretty much the standard cut taken by all the application stores on the various platforms.

Signing Your Game’s APK

After you have successfully registered as an official Android developer, it’s time to prepare your application for publication to Google Play. In order to publish your application, you have to sign the APK file. Before you do that, you should make sure everything is in place. Here’s a laundry list of things to do before signing the APK file:

  • If your build target is equal to or higher than SDK level 8 (Android 2.2), you should also make sure the <manifest> tag has the android:installLocation attribute set to preferExternal or auto. This will satisfy your users by ensuring that your application is installed on external storage if possible.

  • Make sure you only specify the permissions that your game really needs. Users don’t like to install applications that seem to demand unnecessary permissions. Check the <uses-permission> tags in your manifest file.

Double-check all of these items. Once you are done, you can finally export a signed APK file that is ready to be uploaded to Google Play by following these steps:

  1. In Android Studio, click on Build ➤ Generate signed APK. This will bring up the Generate Signed APK dialog, shown in Figure 15-1.

    A340874_3_En_15_Fig1_HTML.jpg
    Figure 15-1. The signed export dialog
  2. Click the Create new. . . button to move to the New Key Store dialog, shown in Figure 15-2.

    A340874_3_En_15_Fig2_HTML.jpg
    Figure 15-2. Choosing or creating the key store
  3. A key store is a password-protected file that stores the key with which you sign your APK file. Since you haven’t created a key store yet, you’ll do so now in this dialog.

  4. To create a valid key, you have to complete the Alias, Password, and Validity (years) fields, as well as enter a name in the First and Last Name field. The rest of the fields are optional, but it’s a good idea to fill them out nevertheless. Click Next, and you are shown the final dialog, illustrated in Figure 15-3.

    A340874_3_En_15_Fig3_HTML.jpg
    Figure 15-3. Specifying the destination file
  5. Specify where the exported APK file should be stored, and make sure to note the path. You’ll need it later when you want to upload that APK. Click Finish.

When you want to publish a new version of a previously published application, you can just reuse the key store you created the first time you went through the wizard. Launch the wizard, and when you get to the Generate Signed APK dialog shown in Figure 15-1, select the “Choose existing. . .” button, provide the location of the key store file you created previously, and provide the password for the key store. Just select the key you created previously, provide the password for it, click Next, and proceed as before. In both cases, the result will be a signed APK file that is ready for upload to Google Play.

Note

Once you upload a signed APK, you have to use the same key to sign any subsequent versions of the same application.

So, you’ve created your first signed APK—congratulations! Now, we’ll throw a wrench into the works and inform you about the multiple APK support. For a single app, you can create multiple APKs that use device capability filtering to get the “best fit” for each user who installs your app. This is a great feature because it means you can do things like the following:

  • Ship specific image sets that are compatible with specific GPUs

  • Have a limited feature set targeted for older versions of Android

  • Ship larger-scale graphics for larger screen sizes and regular-scale graphics for all others

Google will surely add more filters as time goes by, but just the set outlined here enables you to really hone in on a target device (like tablets) without having to jump through too many hoops to keep the download at a reasonable size for first-generation device support.

Putting Your Game on Google Play

It’s time to log in to your developer account on the Google Play website. Just go to https://play.google.com/apps/publish and register. You’ll be greeted with the interface shown in Figure 15-4.

A340874_3_En_15_Fig4_HTML.jpg
Figure 15-4. Welcome to Google Play, developer!

This interface is what Google calls the Android Developer Console, which is what you caught a glimpse of when initially registering. Now we’re ready to actually use it. Clicking the Add New Application button at the top right-hand side of the screen will let you do that. This will open the Add New Application dialog, which is shown in Figure 15-5.

A340874_3_En_15_Fig5_HTML.jpg
Figure 15-5. Add New Application dialog of the Android Developer Console

After supplying your application’s title, click on the Upload APK button.

You should now see the screen shown in Figure 15-6. This is where you upload your APK and finalize your listing.

A340874_3_En_15_Fig6_HTML.jpg
Figure 15-6. Uploading an APK

This is where you can select to upload your APK file to either the Production, Beta, or Alpha channels. Google has made publishing of apps to Google Play very easy.

Publish!

After providing all of that information, it’s time to click the huge Publish button at the bottom of the page and make your game available to millions of people around the globe! There is no review process, so after an hour or two of server propagation time, your game will come online for all of the supported devices in the Google Play store.

More on the Developer Console

Once your game is published on Google Play, you will want to keep track of its status. How many people have downloaded it so far? Have there been crashes? What are the users saying? You can check all this out in the Android Developer Console (see Figure 15-4).

For each of your published applications, you can get a few pieces of information:

  • Overall rating of your game and number of ratings

  • Comments made by users (just click the Comments link for the respective application)

  • Number of times your application has been installed

  • Number of active installs of your application

  • Error reports

Summary

Publishing your game on Google Play is a breeze, and it has a very low barrier of entry. You now have all the knowledge necessary to design, implement, and publish your first game on Android. May the force be with you!

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

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