Save the world, one oversized APK at a time
Staypuft is a simple, reactive interface to Google's APK Expansion Files service.
It looks like this:
val apkx = Staypuft.getInstance(activity).setConfig(
DownloadConfig(
salt = // your custom salt array
publicKey = "YOUR_PUBLIC_KEY base64",
notifier = DefaultNotifier.withChannelId("expansions")
)
)
That's it! If you want to get status updates, just subscribe to them:
apkx.stateEvents.subscribe { event ->
when (event) {
is DownloadState.Ready -> {
// done!
println("Got main expansion file at: ${event.main}")
}
}
}
Staypuft is distributed via JitPack. To use it, first add the JitPack maven repo to your root build.gradle:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Then add the dependency:
dependencies {
compile 'com.github.dhleong:staypuft:<VERSION>'
}
where <VERSION>
is the latest version (shown in the badge at the
top of this page).
Staypuft provides definitions for the services and permissions it needs,
so you shouldn't even need to modify your manifest. Simply copy and paste
the code above into an appropriate place, fill in the salt
and
publicKey
values, and you're good to go!