Getting your app into Google Play: Basic Steps – continued


Gonzalo hard at work

Post by Gonzalo Serrano, Software Developer

Last post, I ended talking about the content of the Android app package. Let’s look at that a little more in-depth,

Expansion files

Expansion files are used if your app is larger than 100MB. Google supports expansion files up to 2GB, In our case we are using an expansion files that is 300+MB.

Each expansion file you upload can be any format you choose (ZIP, PDF, MP4, etc.). You can also use the JOBB tool to encapsulate and encrypt a set of resource files and subsequent patches for that set. Regardless of the file type, Google Play considers them opaque binary blobs and renames the files using the following scheme:

[main|patch].<expansion-version>.<package-name>.obb

There are three components to this scheme:

main or patch
Specifies whether the file is the main or patch expansion file. There can be only one main file and one patch file for each APK.

<expansion-version>
This is an integer that matches the version code of the APK with which the expansion is first associated (it matches the application’s android:versionCode value).

“First” is emphasized because although the Developer Console allows you to re-use an uploaded expansion file with a new APK, the expansion file’s name does not change—it retains the version applied to it when you first uploaded the file.

<package-name>
Your application’s Java-style package name.

For example, suppose your APK version is 314159 and your package name is com.example.app. If you upload a main expansion file, the file is renamed to:

main.314159.com.example.app.obb

AndroidManifest.XML

Some of the most important data is contained here, not only data but meta data (data about data).

Permissions

Permissions tell the android system what your app is going to need to function. In newer versions the user can manually pick and choose which permissions to allow so this lets them know in advanced which permissions the game needs to work correctly.

    <!-- Required to access Google Play Licensing -->
    <uses-permission android:name="com.android.vending.CHECK_LICENSE" />

    <!-- Required to download files from Google Play -->
    <uses-permission android:name="android.permission.INTERNET" />

    <!-- Required to keep CPU alive while downloading files
        (NOT to keep screen awake) -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <!-- Required to poll the state of the network connection
        and respond to changes -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <!-- Required to check whether Wi-Fi is enabled -->
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

    <!-- Required to write the expansion files on shared storage -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <!-- Required to read the expansion file on shared storage -->
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

    <!-- Required to make in app purchases -->
    <uses-permission android:name="com.android.vending.BILLING" />

provider

The provider tag allows the system to access specific versions of an expansion file. This is helpful for our games so that users don’t have to re-download the big expansion files that we are using.

Obviously, where it says packagname below, you want to put your package name, which will be something like

com.amazing.game.bygonzalo

<provider
            android:authorities="packagename.ZipFileContentProvider"
            android:name=".ZipFileContentProvider">
            <!-- This meta data is for when the expansion file doesn't match the version code of the apk.
                 MainVersion is the last version that was updated so if last version is 3 but your app
                 is on version code 5 this makes sure you can still access the old expansion file.-->
            <meta-data
                android:name="mainVersion"
                android:value="10">
            </meta-data>
            <meta-data
                android:name="patchVersion"
                android:value="0">
            </meta-data>
        </provider>

Okay, back to coding. Next time I’ll discuss activities and services.

If you want to download the Android version of Making Camp, check it out here, it’s free.

Leave a comment

Your email address will not be published. Required fields are marked *