Samples¶
Sample apps showcasing the usage of Ackpine can be found in the GitHub repository. Each sample demonstrates different aspects of the library and serves as a reference for common integration patterns.
Feature matrix¶
| Feature | sample-java | sample-ktx | sample-api34 |
|---|---|---|---|
| Language | Java | Kotlin | Kotlin |
| Async work | Guava's ListenableFuture + LiveData | Coroutines + Flow | Coroutines + Flow |
| Install from APK | ✅ | ✅ | ✅ (direct streaming from web) |
| Install from zipped splits | ✅ | ✅ | ❌ |
| Uninstall apps | ✅ | ✅ | ❌ |
| Progress tracking | ✅ | ✅ | ✅ |
| Process death handling | ✅ | ✅ | ✅ |
| Preapproval (API 34+) | ❌ | ❌ | ✅ |
| Install constraints (API 34+) | ❌ | ❌ | ✅ |
Unit tests with ackpine-test | ✅ | ✅ | ✅ |
sample-java¶
Fully written in Java. Demonstrates the callback-based API with Session.TerminalStateListener and DisposableSubscriptionContainer for lifecycle management.
sample-ktx¶
Leverages the ackpine-ktx artifact with Kotlin coroutines and DSL APIs. Uses Session.await() for session lifecycle management.
sample-api34¶
Showcases features supported on API level 34 and higher, such as install pre-commit preapproval and installation constraints. Installs an APK from web resource with direct streaming using OkHttp.
Key files to study¶
Session management patterns¶
The ViewModel files show how to create sessions, handle state transitions, and manage process death:
sample-java—InstallViewModel.java,UninstallViewModel.javasample-ktx—InstallViewModel.kt,UninstallViewModel.ktsample-api34—MainViewModel.kt
Zipped split APKs¶
Fragments show how to read zipped split APKs:
sample-java—InstallFragment.javasample-ktx—InstallFragment.kt
Testing patterns¶
The test files demonstrate how to use ackpine-test for unit testing session-based logic:
sample-java—InstallViewModelTest.java,UninstallViewModelTest.javasample-ktx—InstallViewModelTest.kt,UninstallViewModelTest.ktsample-api34—MainViewModelTest.kt