Android Application Development For Dummies, 3rd Edition (2015)
Part II. Building and Publishing Your First Application
Chapter 8. Publishing Your App to the Google Play Store
In This Chapter
Building an Android package file
Creating a developer profile in the Google Play Store
Picking a price for your app
Illustrating your app with a screen shot
Uploading and publishing your application
The Google Play Store is the official application distribution mechanism for Android. Publishing your application to the store enables your application to be downloaded, installed, and used by millions of users across the world. Users can also rate your application and leave comments about it, which helps you identify possible use trends and problematic areas that users might be encountering.
The Google Play Store also provides a set of valuable statistics that you can use to track the success of your application.
In this chapter, you publish your application to the Google Play Store. You find out how to provide a couple of screen shots, a promotional screen shot, and a short description of your application.
Creating a Distributable File
So you have a great idea, and it has led you to develop the next hit application or game for the Android platform. Now you’re ready to put the application into the hands of users. The first thing you need to do is package your application so that it can be placed on their devices. To do so, you create an Android package file, or APK file, which you will do in the following sections.
Choosing your tools
You can build an Android APK file in numerous ways:
· Android Studio
· Command line with Gradle
· Automated build process, such as a continuous integration server
Really, these are just three different ways to kick off your gradle build.
In this book you will use Android Studio to create a signed APK file. Android Studio provides an array of tools that compile, digitally sign, and package your Android application into an APK file.
Other options, such as using Gradle and continuous integration to build signed APKs, are used in more advanced scenarios. You can find more information about setting up a command‐line build process in the Android documentation athttp://d.android.com/tools/publishing/app‐signing.html.
Digitally signing your application
The Android system requires all installed applications to be digitally signed with a certificate that contains a public/private key pair. The private key is held by the developer. The certificate that’s used to digitally sign the application identifies developer and establishes the trust relationships between applications.
You need to know some key information about signing Android applications:
· All Android applications must be signed. The system won’t install applications that aren’t signed. By default, your apps are signed by a debug key generated by the Android SDK.
· You can use self‐signed certificates to sign your applications; a certificate authority isn’t needed.
· When you’re ready to release your application to the store, you must sign it with a private release key. You cannot publish the application with the debug key that signs the APK file when debugging the application during development.
· The certificate has an expiration date, and it’s verified only at install time. If the certificate expires after the application has been installed, the application continues to operate normally.
· If you don’t want to use Android Studio to generate the certificate, you can use standard JDK tools such as keytool or jarsigner to sign your APK files.
You can create modular applications that can communicate with each other if the applications were signed with the same certificate. This arrangement allows applications to run within the same process, and the system can, if requested, treat them as a single application. Using this methodology, you can create your application in modules, and users can update each module as they see fit — for example, to create a game and then release update packs to upgrade it. Users can decide to purchase only the updates they want.
The certificate process is outlined in detail in the Android documentation at http://d.android.com/tools/publishing/app‐signing.html.
Creating a keystore
A keystore in Android (and in Java) is a container in which your private certificates reside. You can use a couple of tools in Android to create a keystore file:
· Android Studio Generate Signed APK Wizard: Creates a keystore and a key that will be used to sign your app APK.
· Keytool application: Lets you create a self‐signed keystore via the command line. Keytool, located in the Java bin directory, provides many options via the command line.
Safeguarding your keystore
The keystore file contains your private certificate, which Android uses to identify your application in the Google Play Store. Back up your keystore in a safe location because if you happen to lose it, you cannot sign the application with the same private key. Neither can you upgrade your application because the Google Play Store platform recognizes that the application isn’t signed by the same key and restricts you from upgrading it — the store sees the file as a new Android application. This also happens if you change the package name of the app; Android doesn’t recognize it as a valid update because the package and/or certificate are not the same.
Keep your keystore safe! If your source code is open source, do not check your keystore into your source code. You don’t want the whole Internet to have access to your keystore and be able to modify your app in the Google Play Store whenever it wants. If you ever lose your keystore, you will not be able to update app in the Play Store, and Google would not be able to help you even if they wanted to.
Creating the APK file
To create your first APK file, follow these steps:
1. Choose Build⇒Generate Signed APK.
2. Select the Silent Mode Toggle module and click Next.
The Generate Signed APK Wizard, shown in Figure 8-1, opens with the current project name filled in.
3. Press the Create New button (as shown inFigure 8-2).
Or, if you already have a keystore, press the Choose Existing button instead.
4. Choose the location of your keystore.
Find your project directory (the directory above SilentModeToggle) and create a keystore there named release.jks, as in Figure 8-3. For example: /Users/mike/Projects/android‐for‐dummies‐v3/release.jks.
5. Enter a password that you’ll remember, and reenter it in the Confirm field.
If using an existing keystore, you won’t need to confirm your password.
Your keystore file has been created, but now you need to create a key.
6. Fill out the following fields:
· Alias: A simple name that you use to identify the key. Call it release.
· Password and Confirm: The password that will be used for the key. You can use the same password that you used for the keystore, or you can use a different password.
· Validity: Indicates how long this key will be valid. Your key must expire after October 22, 2033.
7. Complete the certificate issuer section, filling out at least one of these fields:
· First and Last Name
· Organization Unit
· City or Locality
· State or Province
· Country Code (XX)
8. Click OK.
You’ll return to the Generate Signed APK Wizard dialog box, but this time the fields should be filled as in Figure 8-4.
9. Optionally check the Remember password check box so that you don’t have to retype it every time, and click Next.
If you don’t have a Master Password configured for Android Studio, you may be prompted to set one so that Android Studio can remember your password securely.
10. Choose the APK destination folder and the Build Type as inFigure 8-5.
The location should be set to the SilentModeToggle directory, and the Build Type should be release.
11. Click Finish.
The .apk file is created in your chosen location as well as a keystore in the location you chose in Step 4. Open these locations, and you can see a .jks file as well as an .apk file.
Figure 8‐1: The Generate Signed APK Wizard.
Figure 8‐2: The Keystore Selection screen.
Figure 8‐3: The Key Creation screen.
Figure 8‐4: The Generate Signed APK Wizard screen with fields filled out.
Figure 8‐5: Providing a destination for the APK file.
You have created a distributable APK file and a reusable keystore for future updates.
Creating a Google Play Developer Profile
After you have created an APK file, you can release the application on the Google Play Store. To do so, you create a Google Play developer profile. To create this profile, you first need a Google account. Any Google‐based account, such as a Gmail account, works. If you have no Google account, you can open a free one by navigating to www.google.com/accounts.
To create the Google Play developer profile, follow these steps:
1. Open your web browser and navigate to http://play.google.com/apps/publish.
2. Sign in to your Google account.
If you’re already signed in to your account, you go straight to Step 3 to fill in your developer profile.
3. Check “I agree” to accept the terms of the developer agreement (Figure 8-6), and then click Continue to Payment.
If you don’t pay the developer fee, you cannot publish applications.
4. On the Secure Checkout page, fill in your credit card details and billing information, then click the Accept and Continue button.
If you already have a credit card on file with Google, you may not see the page in Figure 8-7. If you already have a card set up, select one and continue.
5. Fill out the following fields to complete your developer profile, as shown inFigure 8-8:
· Developer Name: The name that appears as the developer of the applications you release, such as your company name or your personal name. You can change it later, after you’ve created your developer profile.
· Email Address: The email address to which users can send email with questions or comments about your application.
· Phone Number: A valid phone number at which to contact you to discuss problems with your published content.
6. Scroll down and click the Complete Registration button.
Congratulations, you are now a registered Android developer! The Android developer home page opens, as shown in Figure 8-9, where you can upload your application or set up a merchant account (which you need, if you’ll be charging a fee for your apps). See the nearby “Google Wallet merchant accounts” sidebar.
Figure 8‐6: The Google Play Developer Console.
Figure 8‐7: Pay with Google Wallet.
Figure 8‐8: Developer listing details.
Figure 8‐9: The Google Play Developer Console.
Google Wallet merchant accounts
To have a paid application on the Google Play Store, you must set up a Google Wallet merchant account. To set it up, choose Setup Merchant Account from the Google Play developer console (refer to Figure 8-9) and provide these types of information:
· Personal and business name
· Tax identity (personal or corporation)
· Expected monthly revenue ($1 billion, right?)
After you have set up a Google Wallet merchant account, you can sell your applications.
Pricing Your Application
So you have created an APK file and you’re a registered Android developer. Now you’re ready to put your app into users’ hands. (Finally!) But you must answer one last question — is your app a free app or a paid app?
Make this decision before you release your app, because its price has psychological consequences for potential customers or users and monetary consequences for you. If yours is a paid application, you have to determine your price point. Only you can make this decision, so check out similar applications in the Play Store, and their price points, to determine your pricing strategy. The majority of apps are priced between $0.99 and $9.99. Keeping the pricing of your app competitive with your market is a game of economics that you have to play to determine what works for your application.
The paid‐versus‐free discussion is an evergreen debate, and both sides can be profitable. You only have to figure out what works best for your application, given your situation.
Choosing the paid model
If you choose the paid model for your app, you generally start seeing money in your pocket within 24 hours of the first sale (barring holidays and weekends). However, your paid application probably won’t receive many active installs.
Users who download your app from the Google Play Store get a free, 2‐hour trial period to try out your paid application. During the trial period, users can experiment with the fully functional application, and if they don’t like it, simply uninstall it for a full refund. The trial period is extremely useful because users aren’t penalized for taking your app for a brief test‐drive.
Choosing the free model
If you choose to take the free route, users can install the application for free. Between 50 and 80 percent of the users who install your free app will keep the application on the device; the others will uninstall it. The elephant in the room now is the question of how to make money by creating free apps.
As the age‐old saying goes, nothing in life is free, and the saying applies to making money on free apps. You have two basic options:
· In‐app purchases: You identify different “upgrades” that users can buy when using your app, which are then managed via the Google Play Store.
· Advertising: Various mobile advertising agencies provide third‐party libraries to display ads on your mobile application.
The top mobile advertising company is Google (https://developer.android.com/google/play‐services/ads.html). Google offers useful SDKs and walks you through the steps to run ads on your native Android applications. Google pays on a net‐60‐day cycle, so you may have to wait a few months to receive your first check.
Getting Screen Shots for Your Application
Screen shots are a vital part of the Google Play Store ecosystem because they allow users to preview an application before installing it. Allowing users to view a couple of screen shots of your application can be the determining factor in installing your application. If you’ve spent weeks (or months) creating detailed graphics for a game that you want users to play, you want potential users and buyers to see them so that they can see the overall look of your app.
To grab real‐time shots of your application, you use an emulator or a physical Android device. To grab screen shots with an emulator, follow these steps:
1. Open the emulator.
2. In Android Studio, choose View⇒Tool Windows⇒Android.
3. Click the Screenshot button to take a screen shot.
After the screen shot is taken, save the file somewhere on your computer.
Uploading Your Application to the Google Play Store
You’ve finally reached the apex of Android application development: You’re ready to publish the application. To publish your app, you’ll need to collect the following information:
· The signed APK
· Your screen shots
· A description and promotional text for your application
· A promotional image used to advertise your app if it’s featured in the Google Play Store
Publishing an application is easy — follow these steps:
1. On the Android developer’s home page (refer toFigure 8-9), click the Publish an Android App on Google Play button.
The Add New Application page opens, as shown in Figure 8-10.
2. Click Upload APK, and choose the .apk file that you created earlier in this chapter.
No two applications can have the same package name in the Google Play Store. Therefore, if you try to upload the Silent Mode Toggle application at this point, you see this error message:
The package name of your apk (com.dummies.silentmodetoggle) is the same as
the package name of another developer’s application. Choose a
new package name.
When you upload an application that you’ve created, you don’t see this message.
3. Click Store Listing, and set the description for your application (seeFigure 8-11).
Users see this description when they inspect your application to determine whether to install it. All this text is indexed for the Google Play Store search engine.
4. Scroll down to the Screenshots section and add two screen shots from your application.
Apps with screen shots have higher install rates than apps without them. These screen shots allow users to preview your application in a running state without having to install your application.
5. Add a promotional shot.
The promo shot is not a screen shot but rather an advertisement used for random promotions that Android chooses to showcase.
6. Upload a high‐resolution app icon image.
Refer to Chapter 6 for instructions on how to create a 512‐x‐512‐high resolution app icon.
7. Set the promotional text of your application.
Promotional text is used when your application is featured or promoted in the Google Play Store. Getting your application featured is likely based on the popularity of your application. If it’s chosen to be featured in the promotional area of the Google Play Store (usually in the upper area of the screen of each category), the promo text shows up as the promotional component for it.
8. Set the application type, category, and content rating.
This app falls into the Applications type; if you have a game app, choose the Games type.
The Category is based on your application type.
The Content Rating helps to prevent kids from seeing things that are too mature for them.
9. Fill out the Web Site and E‐Mail fields (and Phone, if you want).
These fields are used to contact you for various reasons, including app feature requests and bug reports. If you fill in the Phone field, remember that users can call to speak with you. If you’re writing an app for one company and publishing it under your developer account, you can change the Web Site, E‐Mail, and Phone fields so that users can’t contact you.
10. Click Save, then click Pricing and Distribution (seeFigure 8-12).
11. Select the list of countries where the application should be visible.
For example, if your application is meant for an Italian audience, deselect All Locations and select Italy as the destination location, to ensure that only devices in the Italy region can see it in the store. If you leave All Locations enabled, all locations can (you guessed it) see your app in the store.
12. Verify that your application meets the Android content guidelines and that you have complied with applicable laws by selecting the pertinent check boxes.
13. Click Save, then click Publish.
Your application is published to the Google Play Store.
Figure 8‐10: The Add New Application page.
Figure 8‐11: The Store Listing.
Figure 8‐12: The Pricing and Distribution page.
Figure 8-13 shows an application in the Google Play Store.
Figure 8‐13: The application is released in the Google Play Store.
You’ve probably noticed a certain highlight in this process: It has no app‐approval process (like a certain other platform does). You can create an app now and publish it, and users can install it within a few minutes or hours. You can then complete a quick release cycle and get new features out the door as quickly as you finish them — very cool.
Watching the Number of Installs Soar
You’ve finally published your first application. Now it’s time to watch those millions start rolling in, right? Kind of. You might be an independent developer who’s releasing the next standout first‐person shooter game, or you might be a corporate developer who’s pushing out your company’s Android application. Regardless, to be aware of the user experience on various devices, you can identify how your application is doing in various ways using the Google Play developer console:
· Five‐star rating system: The higher average rating your app receives, the more likely people will install it.
· Comments: Give people the courtesy of reading the comments they leave. You might be surprised at the outstanding ideas people provide to you for free. Users get excited about new features and return to the store to update their comments with a much more positive ratings boost.
· Error reports: Users who were gracious enough to submit error reports want to let you know that the app experienced a runtime exception for an unknown reason. Open these reports in the Google Play developer console, examine the error, review the stack trace, and fix the problem. An app that’s reported to force‐close frequently can quickly receive lots of bad reviews.
· Installs versus active installs: Though this comparison isn’t the best metric for identifying user satisfaction, it’s an unscientific way to determine whether users who install your app will tend to keep it on their devices. Users who keep your app probably like it.
· Direct email: Users will return to the Google Play Store to find your email address or website address and ask questions about features or send comments about their user experience. They may also send you ideas about how to improve your app or ask you to create another app that does something they cannot find at the Google Play Store. Reply if you have the time! Though maintaining an active dialogue with users is difficult if your app has a million active users, it makes users happy to know that they can contact you about issues with your app.
Staying in touch with your user base is a large task in itself, but doing so can reap the reward of dedicated, happy customers who refer their friends and family to your application.
Like the Google Play Store, the Amazon App Store for Android (one of the largest non‐Google app stores for Android devices) offers applications for users to buy and install. Developers can sell their applications and receive a competitive rate for their apps from Amazon, or post free apps. Amazon also provides great sales metrics for developers and marketers. Find out more at http://developer.amazon.com. You can find out how to port your app to the Amazon App Store in Chapter 20.