F-Droid supports APK Expansion Files aka OBB

Many games, mapping, and other apps require a large amount of data to
work. The APK file of an Android app is limited to 100MB in size, yet
it is common for a single country map file to be well over 100MB.
Also, in order to get users running as quickly as possible, they
should not have to wait for huge amounts of data to download in order
to just start the app for the first time.

Google created OBB aka “APK Expansion” files to provide a flexible means of delivering large amounts of data.
This arragement also saves lots of bandwidth since app updates since
the APK file and the OBB file can be updated separately. For example,
a game’s assets do not need to change often, so they can be shipped as
an OBB. Then when the app itself is updated (i.e. the APK), it
does not need to include all those assets that are in the OBB file.

OBB files are used by lots of apps like games and MAPS.ME. F-Droid
supports OBB by downloading and installing the OBB before the APK, so
that once the APK is installed, the OBB files are already in place and
ready to use. F-Droid also provides an Intent method for apps to
fetch the OBB download URLs in case the app itself needs to handle the
OBB download/update. That is similar to how it works in Google Play.

In order to use the OBB support, users need at least F-Droid v0.102, and the repo must use fdroidserver v0.7.0 or newer. Adding OBB files to a repo is very easy: just copy them to the same folder where the APKs go, i.e. /path/to/fdroid/repo/.

Developer Usage

One of the details about using OBB files in apps is that OBB files are not guaranteed to be installed by the app store. That means the app could start, and the expected OBB files will not be there. In that case, the app must download and install the OBB file itself. Google Play recommends using their proprietary Application Licensing service for this, F-Droid provides a simple method that is all free software.

To get the URL for the two possible OBB files, send an Intent to
F-Droid using these Actions:

  • org.fdroid.fdroid.action.GET_OBB_MAIN_URL
  • org.fdroid.fdroid.action.GET_OBB_PATCH_URL

Then download that URL using your favorite method, and make sure that
the file ultimately ends up in Android/obb/<packageName> on the
device’s External Storage.

2 Likes

this feature would allow offline map apps if the maps can be downloaded seperately so the map consuming app would not need internet permissions on it-s own.

however this would cause huge fdroid serverpayload. (i.e a high detail mapsforge offline map of germany is 1.8 GB.)

currently the geomap of my app APhotoManager can consume mapsforge offline maps but it cannot download these through a menü because there is no server to take the burden.

if fdroid server really have that capacity a shared obb would be greate so that all map displaying apps can use the same maps.

The way to start using this OBB support for map data files would be for
someone to setup an fdroid repo that includes the OBB support. From
that, we can tell whether it would be feasible to host the OBB files on
f-droid.org. Once we get mirror support fully implemented, the
bandwidth might be manageable:
Mirror support for the index and apps (!578) · Merge requests · F-Droid / Client · GitLab

As far as I know, most map apps have their own data file format, so I
don’t think OBB files could be shared.