Android Apps Over the 50MB Barrier

 

Android applications have historically been limited to a maximum size of 50MB. This works for most apps, and smaller is usually better — every megabyte you add makes it harder for your users to download and get started. However, some types of apps, like high-quality 3D interactive games, require more local resources.

So today, we’re expanding the Android app size limit to 4GB.

The size of your APK file will still be limited to 50MB to ensure secure on-device storage, but you can now attach expansion files to your APK.

  • Each app can have two expansion files, each one up to 2GB, in whatever format you choose.
  • Android Market will host the files to save you the hassle and cost of file serving.
  • Users will see the total size of your app and all of the downloads before they install/purchase.

On most newer devices, when users download your app from Android Market, the expansion files will be downloaded automatically, and the refund period won’t start until the expansion files are downloaded. On older devices, your app will download the expansion files the first time it runs, via a downloader library which we’ve provided below.

While you can use the two expansion files any way you wish, we recommend that one serve as the initial download and be rarely if ever updated; the second can be smaller and serve as a “patch carrier,” getting versioned with each major release.

Helpful Resources

In order to make expansion file downloading as easy as possible for developers, we’re providing sample code and libraries in the Android SDK Manager.

  • In the Google Market Licensing package, an updated License Verification Library (LVL). This minor update mostly adds the ability to obtain expansion file details from the licensing server.
  • From the Google Market APK Expansion package, the downloader service example. The library makes it relatively simple to implement a downloader service in your application that follows many of our best practices, including resuming downloads and displaying a progress notification.

Because many developers may not be used to working with one or two large files for all of their secondary content, the example code also includes support for using a Zip file as the secondary file. The Zip example implements a reasonable patching strategy that allows for the main expansion file to “patch” the APK and the patch file to “patch” both the APK and the main expansion file by searching for asset files in all three places, in the order patch->main->APK.

Expansion File Basics

Expansion files have a specific naming convention and are located in a specific place for each app. As expansion files are uploaded to the publisher site, they are assigned a version code based upon the version of the APK that they are associated with. The naming convention and location are as follows:

Location: /Android/obb//
Filename: [main|patch]...obb
Example: /sdcard/Android/obb/com.example.myapp/main.5.com.example.myapp.obb

Expansion files are stored in shared storage. Unlike APK files, they can be read by any application.

Downloading and Using the Expansion Files

When the primary activity for the app is created, it should check to make sure the expansion files are available. The downloader library provides helper functions (for example the “Helpers” class in the code below) to make this easy.

boolean expansionFilesDelivered() {
    // get filename where main == true and version == 3
    String fileName = Helpers.getExpansionAPKFileName(this, true, 3);
    // does the file exist with FILE_SIZE?
    if (!Helpers.doesFileExist(this, fileName, FILE_SIZE, false)) {
        return false;
    }
    return true;
}

If the file does not exist, fire up the downloader service with DownloaderClientMarshaller.startDownloadServiceIfRequired(). The downloader will perform an LVL check against the server. This check will deliver the names of the files, file sizes, and the file URLs.

Once that check has been completed, it will begin downloading the files. You don’t have to use our download solution, but you might want to because we:

  • Include a notification UI that provides progress and estimated completion time in layouts customized for ICS and pre-ICS devices
  • Resume large files safely
  • Handle redirection with appropriate limits
  • Run in the background as a service
  • Pause and resume downloads when WiFi is not available

Enjoy! We can’t wait to see what kinds of things developers do with this! For more information about how to use expansion files with your app, read the APK Expansion Files developer guide.

How to make the Google Earth Flight Simulator easier to use

 

Alan Huestis writes the Google Earth Flight Sim blog, as he is a big fan of that feature in Google Earth. Like many of you, he purchased a joystick (the Logitech Attack 3) to help make the sim feel more realistic, but he wasn’t happy with the button mapping. To solve that, he re-wrote the joystick.ini file to make it easier to use.

 

logitech-attack-3.jpg 

Here are the changes he made:

  • I use the original code to handle joystick movement (back and forward, side to side) and to handle the throttle.
  • I have four keys on the top, and I use the side keys to move the rudder in 20% increments. The centre key returns the rudder to centre, and the top key just pauses the action so I can answer the phone. On the small plane I do not usually use the rudder but on the jet there is much more need of rudder as one can’t turn much by just banking.
  • I have two buttons on the left side of the base and I use them to increase the flaps by 20% and decrease the flaps by 20%.
  • There are two buttons at the rear of the base and I have mapped them to the left and right brakes. On the small plane one can steer on the ground with the brakes, and even turn around on a runway and take off again. The brakes do not seem to slow the jet much and I often overshoot a runway even though I am safely down.
  • There are two buttons on the right side of the base and I have used those to control attitude but I rarely use them in flight.
  • I have mapped the trigger key to change the view. In normal flight we look out over the nose and we see the instrument display. When I pull the trigger the instrument display disappears and the view angle changes to downwards and slightly forward. I usually fly the small plane, and with full flaps and half throttle, flying at about 500 feet, and with the trigger depressed it seems like I am an eagle soaring over familiar landscapes. The effect is just magical. At that airspeed I can still maneuver and climb slightly, but it is slow enough that the earth beneath me does not blur.

Here is the .ini file that Alan wrote to work with his joystick, named “Logitech_Attack3.ini”:

controllers_supported = [
Controller(‘*Logitech*Attack*3*’, 11, 11, 3, 3)
]

button_press = [
B0 set(VAngle, -0.35)
B1 set(DR, 0)
B1 set(dDR, 0)
B2 toggle(TotalFreeze)
B3 set(dDR, -0.8)
B4 set(dDR, +0.8)
B5 add(DF, -0.2, 0, 1)
B6 add(DF, 0.2, 0, 1)
B7 set(DB_0, 1)
B8 set(DB_1, 1)
]

button_release = [
B0 set(VAngle, 0)
B3 set(dDR, 0)
B4 set(dDR, 0)
B7 set(DB_0, 0)
B8 set(DB_1, 0)
]

axes = [
A0 set(DA, 1.0, 0.0)
A1 set(DE, 1.0, 0.0)
A2 set(DP_0, -0.5, 0.5)
]

povs = [
]

In his case, the file is located here:
C:Program FilesGoogleGoogle Earthclientresflightsimcontroller

Simply replace that file with the contents above (after you back it up, of course) to be able to use his settings.

Nice updates to the Blue Marble

Google Earth provides some amazing imagery of the earth, but as most of you know, the wide view of earth isn’t the greatest due to the patchwork of imagery across the globe. Fortunately, back in 2006 Frank released the Blue Marble, which uses beautiful imagery from NASA to show off the earth. NASA imagery shows a different image for each month of the year so you see a cloudless representation of the earth with vegetation colors and snow/ice as seen from space for that month, and the file below shows the current month.

blue-marble.jpg

The Blue Marble allows Earth to look more realistic when viewed from space, but the file automatically hides itself as you zoom in so that you can still see the sharp satellite imagery on the ground.

Due to some issues with the file locations, Frank recently had to update the file. While he was in there he made some nice tweaks to it, including removing the old cloud images. The result is a great-looking, lightweight file to make Google Earth look excellent! Frank had hopes Google would someday add such a feature into Google Earth, but there’s no sign of that yet. Best viewed if you turn off other layers like the Borders layer so it looks more like the view from space. You can also turn on the Weather->Clouds layer and the View->Sun menu option to add realism.

To try it for yourself, simply download this KML file and that’s it! Thanks to Frank for continuing to maintain such a great add-on.

You can also view a Blue Marble time animation Frank created that shows all 12 months of the Blue Marble in Google Earth.