Until today, Android applications have been limited to a maximum size of 50MB. But no more, starting today, Google expands the Android app size limit to 4GB. Google cites the reason of incresing file limit — “some types of apps, like high-quality 3D interactive games, require more local resources,” Android team said.
“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,” explains Google.
“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,” informs the Android Developers team blog.
In order to make expansion file downloading as easy as possible for developers, Google providing sample code and libraries in the Android SDK Manager.
“Because many developers mayn’t 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 team said.
“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.”
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.
Google explains, “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. 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’ll begin downloading the files.”
For more information about how to use expansion files with your app, read the APK Expansion Files developer guide.