Guide: Google Play



  • This guide explains how to create and configure in-app purchases for Google Play.

    Table of Contents:

    • Register developer account
    • Create your app
    • Publishing & testing IAP

    1. Register developer account

    Sign up for a Google Play developer account.
    There is a $25 one-time registration fee to become a publisher on Google Play.

    Having issues in the registration process? Please see this answer on Google’s support pages.

    2. Create your app

    In this section we will create a new app in Google Play, connect it within Unity and add some in-app purchases.

    2.1 Create app in Google Play

    In case you’ve opened the Developer Console for the first time, you will see an overview of actions. Start with publishing a new app.

    https://www.rebound-games.com/wp-content/uploads/GooglePlay010.png

    https://www.rebound-games.com/wp-content/uploads/GooglePlay020.png

    Each application in Google Play has a license key, which is an unique identifier for your app and prevents unauthorized access. You can find it in the Google Play Developer Console, under All applications > Services & APIs. Copy the full key for the next step.

    https://www.rebound-games.com/wp-content/uploads/GooglePlay030.png

    2.2 Configuring app in Unity

    Locate the IAPManager prefab in the project panel (Simple IAP System > Prefabs > Resources) and insert this license key into the Google Store Key field.

    https://www.rebound-games.com/wp-content/uploads/GooglePlay040.png

    Next, if you want to test your app with the example scenes provided by Simple IAP System, you have to add them to your Build Settings. Disable the non-mobile related scenes as seen in the following screenshot, and make sure that the AllSelection scene is the first scene to load.

    https://www.rebound-games.com/wp-content/uploads/GooglePlay050.png

    Switch to the Android platform (File > Build Setting) and open the Unity settings for Android by pressing Player Settings.

    https://www.rebound-games.com/wp-content/uploads/GooglePlay051.png

    In the "Other Settings" section, change the bundle identifier to what you like it to be, but keep the format of com.company.appname. If you already have a published app on Google Play, make sure that the bundle identifier here is the same as displayed for your app in the Developer Console.

    The bundle version and bundle version code in the Unity settings for Android will default to 1.0 / 1 for new apps, which is fine for now. If you are testing with a new app, you do not have to change this for each build! Just keep the 1.0 / 1 until your app is done and about to go live globally. If you’ve published an app on Google Play already, replace this with their associated bundle version and version code from the Developer Console (on the App Releases section).

    https://www.rebound-games.com/wp-content/uploads/GooglePlay060.png

    If you didn’t publish an app before, you probably didn’t create a Keystore yet. To do so, open the Unity settings for Android (File > Build Settings > Player Settings) and expand the Publishing Settings. Enable Create New Keystore, enter your password (twice) below and in the Key Alias, select Create a new key. A new window opens – enter the necessary information. Save this Keystore somewhere safe! If you lose your Keystore, you cannot submit app updates in Google Play anymore.

    If you would like to use an existing Keystore, choose Browse Keystore and enter your Keystore password, then select the Alias and enter the same password again.

    https://www.rebound-games.com/wp-content/uploads/GooglePlay061.png

    On the Google Play dashboard, the bundle identifier will be displayed on the application overview once you've uploaded an APK. This is what we are going to do next.

    https://www.rebound-games.com/wp-content/uploads/GooglePlay070.png

    When exporting the APK, note that "Development Build" needs to be unchecked, even if we are going to upload it to a testing track later. We are only going to save the APK file created in this process on the hard drive (and not using Build And Run), because Google Play still needs some settings to be configured first.

    https://www.rebound-games.com/wp-content/uploads/GooglePlay080.png

    2.3 Entering app details

    First, open the "App releases" section and upload your APK to the Alpha, Beta or Internal Testing track. In this guide we chose the Beta track.

    https://www.rebound-games.com/wp-content/uploads/GooglePlay090.png

    After uploading the APK, begin filling out the other sections - starting with the "Store listing" and "Pricing & distribution". The checkmark next to the tabs will be highlighted in green after you have entered every information necessary.

    https://www.rebound-games.com/wp-content/uploads/GooglePlay100.png

    Continue with the "Content rating" and "App content" tab, by going through the wizard provided on these sections. After this step, all tabs should be highlighted in green.

    https://www.rebound-games.com/wp-content/uploads/GooglePlay110.png

    2.4 Create in-app purchases

    Open our IAP Settings editor in Unity and define your IAPs (Create Product > In App Purchase, Type = Currency or Default). For a definition of Non-Consumable, Consumable and Subscription product types please refer to Google's documentation.

    https://www.rebound-games.com/wp-content/uploads/GooglePlay120.png

    In Google Play's "In-app products" section, add the same products with the exact same product identifier (ID). Consumable and non-consumable products are managed products, whereas subscriptions have their own tab. Only active products can be purchased. Note: If you add translations for your products, Simple IAP System is able to display product details in the user’s native language, which naturally increases IAP conversion rates (recommended).

    https://www.rebound-games.com/wp-content/uploads/GooglePlay130.png

    At this point, you should now have the exact same product identifiers available in Google Play and in our IAP Settings editor.

    3. Publishing & testing IAPs

    3.1 Publish app

    Back to the "App releases" section, define which testing method you prefer to use. Open Beta Testing is the easiest way thus used here. It provides a URL where testers can subscribe for your app testing program.

    https://www.rebound-games.com/wp-content/uploads/GooglePlay180.png

    You are now ready to publish your app. Don’t worry: because you’ve uploaded an alpha or beta build, the app will not be visible publicly – only for you to test it. Within your defined app release, start the rollout! The publishing process can take up to 24 hours before it is available for testing.

    https://www.rebound-games.com/wp-content/uploads/GooglePlay190.png

    3.2 Add test accounts

    While waiting for your app to get published, return to the Google Play dashboard overview. Under Settings, go to the Account details tab and add your Gmail account for testing access. To test in-app purchases, you will have to add an email address which is NOT the email used to register your Google Play Developer account and then add this email on your device. Otherwise, you will get the error message "The publisher cannot purchase this item".

    https://www.rebound-games.com/wp-content/uploads/GooglePlay200.png

    https://www.rebound-games.com/wp-content/uploads/GooglePlay210.png

    3.3 Testing IAPs on your device

    After you've waited the ~24 hour submission approval for your app on Google Play, your app should display as published with a link to Google Play, that is correctly displaying the store page.

    https://www.rebound-games.com/wp-content/uploads/GooglePlay220.png

    If you chose "Open Beta Testing" previously, the "App releases" - "Manage testers" page displays a link to subscribe for testing. Open it with any Gmail account (that is not the Google Play admin account) and join the testing program.

    https://www.rebound-games.com/wp-content/uploads/GooglePlay230.png

    Go back to Unity and open the Build Settings. First, enable Development Build. This enables log messages sent by Simple IAP System on your device for debug purposes. Don’t forget to disable Development Build for your live apps. Finally press Build And Run to deploy your project to your connected Android device. If you change values in the IAP Settings editor of Simple IAP System later, you need to uninstall your app from the device before deploying it again (so that any locally cached product data is wiped).

    https://www.rebound-games.com/wp-content/uploads/GooglePlay240.png

    When the app has started on your device, enter your shop scene and try to purchase a product. Log in with your test account when prompted. If it does not prompt for your Google Play account, go to your Google Play device settings and disable automatic password completion in the authentication options. Purchasing a product in your app should show a popup similar to this one:

    https://www.rebound-games.com/wp-content/uploads/GooglePlay250.png

    Success!



  • Unsolved Errors

    If you can’t see any products or if the purchase popup does not show up at all, you may have some issues with your Unity/Google Play settings and/or errors on the device. Please verify that all of the following points have been met:

    • Google developer key is present on IAPManager prefab
    • app bundle identifier in Unity matches the app identifier in Google Play
    • app is published as alpha or beta in Google Play (draft apps do NOT work!)
    • in-app purchase identifiers in the SIS IAP Settings editor matches the IAP identifiers created in Google Play
    • in-app purchases are published in Google Play
    • you have added test user accounts in Google Play
    • you are logged in with a Google Play test user account on the device

    Still having issues? You could install CatLog (could require root access) for reading the device log over your USB connection, or do it manually . In both cases, filter for Unity messages to remove any irrelevant events. For debugging via your pc, open a command prompt and navigate to the adb.exe on your hard drive (located where you installed the Android SDK > platform-tools directory). Next, enter adb.exe logcat –s Unity to start the debugging connection. Run your app on the device again and watch out for errors!


Log in to reply